42 lines
771 B
Bash
42 lines
771 B
Bash
mkpasswd() {
|
|
LEN=${1:-30}
|
|
tr -cd ' -~' < /dev/urandom | fold -w $LEN | sed 1q
|
|
}
|
|
|
|
mkpasswd2() {
|
|
LEN=${1:-30}
|
|
base64 < /dev/urandom | fold -w $LEN | sed 1q
|
|
}
|
|
|
|
gitall() {
|
|
ROOT=$(pwd)
|
|
find . -name '.git' | while read repo; do
|
|
repodir=$(dirname "$repo")
|
|
reponame=$(basename "$repodir")
|
|
cd "$repodir"
|
|
|
|
echo "==================================="
|
|
echo "===> $reponame"
|
|
echo "==================================="
|
|
|
|
git $@
|
|
|
|
cd "$ROOT";
|
|
done
|
|
}
|
|
|
|
md5dir() {
|
|
find $1 -type f -print0 | xargs -0 md5sum
|
|
}
|
|
|
|
ssh-fingerprint() {
|
|
SERVER=$1
|
|
PORT=${2:-22}
|
|
|
|
ssh-keygen -E md5 -lf <(ssh-keyscan -p $PORT $SERVER 2>/dev/null)
|
|
}
|
|
|
|
SAVEDPROMPT="$PROMPT"
|
|
prefix() {
|
|
export PROMPT="($1)$SAVEDPROMPT"
|
|
}
|