Skip to content

Instantly share code, notes, and snippets.

@treyka
Created November 2, 2012 08:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save treyka/3999558 to your computer and use it in GitHub Desktop.
Save treyka/3999558 to your computer and use it in GitHub Desktop.
quick shell hack for generating xkcd-style passwords
#!/bin/bash
# quick shell hack for generating xkcd-style passwords
wordcount=$1
MIN_WORD_LENGTH=4
MAX_WORD_LENGTH=7
LANGUAGE='en'
for i in $(seq 1 ${wordcount}); do
echo -n $(aspell -d "${LANGUAGE}" dump master \
| egrep "^[[:alpha:]]{$MIN_WORD_LENGTH,$MAX_WORD_LENGTH}$" \
| shuf | tail -n 1 | tr [:upper:] [:lower:])
echo -n " "
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment