Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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