Skip to content

Instantly share code, notes, and snippets.

@melissaboiko
Created February 24, 2012 21:15
Show Gist options
  • Save melissaboiko/1903791 to your computer and use it in GitHub Desktop.
Save melissaboiko/1903791 to your computer and use it in GitHub Desktop.
kind of dumb script to generate xkcd-style password
#!/bin/bash
# http://xkcd.com/936/
# http://namakajiri.net/misc/substantivos_pt.ascii
# TODO: getopt
# dict="/usr/share/dict/words"
# dict="/usr/share/dict/brazilian.utf8"
dict=/usr/local/share/dict/substantivos_pt.ascii
set -e
[ -r $dict ]
which shuf >/dev/null
function choose_word()
{
while true; do
choice=$(shuf -n 1 $dict)
if ! echo $choice | grep -q "^[A-Z]"; then
break
fi
done
echo $choice
}
echo "$(choose_word)$(choose_word)$(choose_word)$(choose_word)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment