Skip to content

Commit

Permalink
適当乱数生成関数をshellで打てるように
Browse files Browse the repository at this point in the history
  • Loading branch information
Akihiro Saiki committed Jan 4, 2024
1 parent 1705231 commit 0f0ee6d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions zsh/zshrc.lazy
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,22 @@ function _fzf_cd_ghq() {
zle -N _fzf_cd_ghq
bindkey "^g" _fzf_cd_ghq

## Random Generator
function rand_str() {
if [ $# -eq 0 ]; then
RAND_LEN=16
else
RAND_LEN=$1
fi
LC_ALL=C tr -dc 'A-Za-z0-9' < /dev/urandom | head -c "$RAND_LEN"; echo
}

function rand_sym() {
if [ $# -eq 0 ]; then
RAND_LEN=16
else
RAND_LEN=$1
fi
LC_ALL=C tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' < /dev/urandom | head -c "$RAND_LEN"; echo
}

0 comments on commit 0f0ee6d

Please sign in to comment.