Skip to content

Instantly share code, notes, and snippets.

@Demuxx
Created July 2, 2014 23:44
Show Gist options
  • Save Demuxx/6744d50cd6a0fa05845c to your computer and use it in GitHub Desktop.
Save Demuxx/6744d50cd6a0fa05845c to your computer and use it in GitHub Desktop.
Ruby password generator
#!/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