chezmoi init
This commit is contained in:
commit
530d6d7195
1176 changed files with 111325 additions and 0 deletions
32
dot_oh-my-zsh/plugins/genpass/executable_genpass-monkey
Normal file
32
dot_oh-my-zsh/plugins/genpass/executable_genpass-monkey
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env zsh
|
||||
#
|
||||
# Usage: genpass-monkey [NUM]
|
||||
#
|
||||
# Generate a password made of 26 alphanumeric characters
|
||||
# with the security margin of at least 128 bits.
|
||||
#
|
||||
# Example password: nz5ej2kypkvcw0rn5cvhs6qxtm
|
||||
#
|
||||
# If given a numerical argument, generate that many passwords.
|
||||
|
||||
emulate -L zsh -o no_unset -o warn_create_global -o warn_nested_var
|
||||
|
||||
if [[ ARGC -gt 1 || ${1-1} != ${~:-<1-$((16#7FFFFFFF))>} ]]; then
|
||||
print -ru2 -- "usage: $0 [NUM]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
zmodload zsh/system || return
|
||||
|
||||
{
|
||||
local -r chars=abcdefghjkmnpqrstvwxyz0123456789
|
||||
local c
|
||||
repeat ${1-1}; do
|
||||
repeat 26; do
|
||||
sysread -s1 c || return
|
||||
# There is uniform because $#chars divides 256.
|
||||
print -rn -- $chars[#c%$#chars+1]
|
||||
done
|
||||
print
|
||||
done
|
||||
} </dev/urandom
|
Loading…
Add table
Add a link
Reference in a new issue