Skip to content

Instantly share code, notes, and snippets.

@yann2192
Created July 23, 2013 09:55
Show Gist options
  • Save yann2192/6061281 to your computer and use it in GitHub Desktop.
Save yann2192/6061281 to your computer and use it in GitHub Desktop.
Python script to gen password
import sys, random, string
myrg = random.SystemRandom()
if len(sys.argv) > 1:
length = int(sys.argv[1])
else:
length = 30
alphabet = "".join((string.letters, string.digits, string.punctuation))
pw = "".join(myrg.choice(alphabet) for _ in range(length))
print pw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment