Created
July 2, 2014 23:44
-
-
Save Demuxx/6744d50cd6a0fa05845c to your computer and use it in GitHub Desktop.
Ruby password generator
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
#!/usr/bin/env ruby | |
o = [('a'..'z'), ('A'..'Z'), (0..9), ('!'..'$'), ('\''.."+")].map { |i| i.to_a }.flatten | |
if !ARGV[0].nil? | |
puts (0...ARGV[0].to_i).map{ o[rand(o.length)] }.join | |
else | |
puts (0...20).map{ o[rand(o.length)] }.join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment