Created
December 17, 2010 18:34
-
-
Save jcromartie/745446 to your computer and use it in GitHub Desktop.
Print a random password tabula recta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# by John Cromartie | |
# idea from http://blog.jgc.org/2010/12/write-your-passwords-down.html | |
# via http://news.ycombinator.com/item?id=2016608 | |
alpha = ("A".."Z").to_a | |
chars = alpha + 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(){}[]-+=.,;:~'.chars.to_a | |
class Array | |
def rand_el | |
self[rand(size)] | |
end | |
end | |
puts ([" "] + alpha).join(" ") | |
puts " " + "--" * alpha.size | |
alpha.each do |row| | |
puts row + "| " + (alpha.collect { |col| chars.rand_el }.join " ") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment