Created
May 2, 2013 23:38
-
-
Save fromheten/5506271 to your computer and use it in GitHub Desktop.
Long passwords
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
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