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

43 lines
771 B
Bash
Raw Normal View History

2015-10-08 14:31:40 +02:00
mkpasswd() {
LEN=${1:-30}
tr -cd ' -~' < /dev/urandom | fold -w $LEN | sed 1q
}
2015-10-13 18:09:25 +02:00
mkpasswd2() {
LEN=${1:-30}
base64 < /dev/urandom | fold -w $LEN | sed 1q
}
2015-11-01 23:54:33 +01:00
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
}
2015-11-12 20:53:23 +01:00
md5dir() {
find $1 -type f -print0 | xargs -0 md5sum
}
2017-05-27 17:21:36 +02:00
ssh-fingerprint() {
SERVER=$1
PORT=${2:-22}
2018-06-21 00:22:12 +02:00
ssh-keygen -E md5 -lf <(ssh-keyscan -p $PORT $SERVER 2>/dev/null)
2017-05-27 17:21:36 +02:00
}
2018-01-22 14:26:49 +01:00
2018-01-23 14:55:49 +01:00
SAVEDPROMPT="$PROMPT"
2018-01-22 14:26:49 +01:00
prefix() {
2018-01-23 14:55:49 +01:00
export PROMPT="($1)$SAVEDPROMPT"
2018-01-22 14:26:49 +01:00
}