Skip to content

Instantly share code, notes, and snippets.

@fromheten
Created May 2, 2013 23:38
Show Gist options
  • Save fromheten/5506271 to your computer and use it in GitHub Desktop.
Save fromheten/5506271 to your computer and use it in GitHub Desktop.
Long passwords
require 'rubygems'
require 'clipboard'
if ARGV[0] === nil
leng = 500
else
leng = ARGV[0]
end
def create_password(pwdlen)
# Defines what character to use in building the password
chars = ('a'..'z').to_a + ('0'..'9').to_a + ('A'..'Z').to_a + 'ÅÄÖ¶©@£$∞§|[]≈±´°!"#€%&/()=?^¨~™-.,;:_'.to_a
pwd = ''
pwdlen.to_i.times { pwd << chars[rand(chars.length)]}
Clipboard.copy pwd
end
create_password(leng)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment