Skip to content

Instantly share code, notes, and snippets.

@yarwelp
Last active December 20, 2015 14:58
Show Gist options
  • Save yarwelp/6150343 to your computer and use it in GitHub Desktop.
Save yarwelp/6150343 to your computer and use it in GitHub Desktop.
Generate a pronouncable password.
#!/usr/bin/env bash
#
# Copyright (c) 2013 Erik Nordstroem <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# File: pwgenp.sh
# Version: 0.1.3
# Description: Generate a pronouncable password.
# Path to word list. You might need to modify this.
WL=/usr/share/dict/words
NL=$( wc -l $WL | awk '{ print $1 }' )
for i in {0..3} ; do
echo $RANDOM $NL | awk '{ srand($1) ; print int($2 * rand()) }' \
| xargs -I curr_l head -n curr_l $WL | tail -n1
done | xargs echo
@yarwelp
Copy link
Author

yarwelp commented Aug 4, 2013

Example use:

$ ~/bin/pwgenp.sh
steatopyga salicorn jud mannitol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment