Skip to content

Instantly share code, notes, and snippets.

@is
Created May 30, 2016 07:22
Show Gist options
  • Select an option

  • Save is/edf7d117b46bed60edc1c55e22a2a134 to your computer and use it in GitHub Desktop.

Select an option

Save is/edf7d117b46bed60edc1c55e22a2a134 to your computer and use it in GitHub Desktop.
genpass
#!/usr/bin/python
import random
import sys
s = 'abcdefghijklmnopqrstuvwxyz'
s += s.upper()
s += '0123456789'
random.seed()
length = 12
if len(sys.argv) >= 2:
length = int(sys.argv[1])
pwd = [s[random.randint(0, len(s) - 1)] for x in range(length)]
print ''.join(pwd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment