Skip to content

Instantly share code, notes, and snippets.

@markusfisch
Last active September 25, 2015 01:57
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 markusfisch/843639 to your computer and use it in GitHub Desktop.
Save markusfisch/843639 to your computer and use it in GitHub Desktop.
mkpasswd in ruby
#!/usr/bin/env ruby
c = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789!-_".split( // )
(ARGV.length.zero? ? [8] : ARGV).each do |n|
puts (0...n.to_i).map{ c[rand( c.size )] }.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment