configfiles/zsh/.zsh/10-helpers.zsh

37 lines
694 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 -lf <(ssh-keyscan -p $PORT $SERVER 2>/dev/null)
}