aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--_zsh/40-functions.zsh8
1 files changed, 8 insertions, 0 deletions
diff --git a/_zsh/40-functions.zsh b/_zsh/40-functions.zsh
index 99f17de..a9d30ed 100644
--- a/_zsh/40-functions.zsh
+++ b/_zsh/40-functions.zsh
@@ -133,4 +133,12 @@ zapply() {
printf '%s\0' "$@[s+1,-1]" | xargs -0 -r -n1 ${(kv)=xopt} "$@[1,s-1]"
}
+
+## Generate random password/string
+randpass() {
+ local len=${1:-16}
+ tr -dc '[:alnum:]' </dev/urandom | head -c ${len} | xargs
+}
+
+
# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=zsh: #