Skip to content

Instantly share code, notes, and snippets.

@jacobsalmela
Forked from alexlovelltroy/random_mnemonic.zsh
Created January 8, 2021 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobsalmela/d92b8d9e297ec07a2683289f22ee53c3 to your computer and use it in GitHub Desktop.
Save jacobsalmela/d92b8d9e297ec07a2683289f22ee53c3 to your computer and use it in GitHub Desktop.
This script uses the menemonic_wordlist from the mnemonic encoding project to generate a set of word pairs
#!/usr/bin/env zsh
#
# This script uses the menemonic_wordlist from the mnemonic encoding project to generate a set of word pairs
# I use them for software release naming conventions and I like choices
# You can get it for yourself with curl
# curl -Lo menmonic_wordlist.txt http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt
#
#
MNEMONIC_FILE="$HOME/Documents/mnemonic_wordlist.txt"
function random_word {
WORDLINE=$(( $(($RANDOM % $(wc -l $MNEMONIC_FILE|awk '{print $1}'))) + 1))
WORDCOL=$(( $(($RANDOM % 6)) + 1 ))
WORD=$(head -$WORDLINE $MNEMONIC_FILE | tail -1 | awk -v word=$WORDCOL '{print $word }')
echo -n $WORD
}
random_word
echo -n " "
random_word
echo " "
random_word
echo -n " "
random_word
echo " "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment