Skip to content

Instantly share code, notes, and snippets.

@sunny
Created August 20, 2010 13:32
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 sunny/540312 to your computer and use it in GitHub Desktop.
Save sunny/540312 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
# Prints out a memorable password.
#
# Example:
# $ mdp
# Kasubian704
# $ mdp 3
# trefle173
# semilunar557
# derride305
(ARGV.first or 1).to_i.times {
puts open('/usr/share/dict/words') { |f|
f.inject { |choice, line| rand < 1/f.lineno.to_f ? line : choice }.to_s.strip
} + (rand * 1000).round.to_s
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment