Skip to content

Instantly share code, notes, and snippets.

@haxxinen
Created February 26, 2020 14:24
Show Gist options
  • Save haxxinen/76bad1a97de2b54c79f86818a32dad3a to your computer and use it in GitHub Desktop.
Save haxxinen/76bad1a97de2b54c79f86818a32dad3a to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys
if __name__ == "__main__":
if len(sys.argv) != 2:
print("usage: %s names.txt" % (sys.argv[0]))
sys.exit(0)
for line in open(sys.argv[1]):
name = ''.join([c for c in line if c == " " or c.isalpha()])
tokens = name.lower().split()
fname = tokens[0]
lname = tokens[-1]
print(fname + lname) # johndoe
print(lname + fname) # doejohn
print(fname + "." + lname) # john.doe
print(lname + "." + fname) # doe.john
print(lname + fname[0]) # doej
print(fname[0] + lname) # jdoe
print(lname[0] + fname) # djoe
print(fname[0] + "." + lname) # j.doe
print(lname[0] + "." + fname) # d.john
print(fname) # john
print(lname) # joe
# generate usernames based on Firstname Lastname
# http http://10.10.10.175/about.html | grep -oE '[A-Za-z]{1,} [A-Za-z]{1,}' > /tmp/about.txt
# python3 usernames_gen.py /tmp/about.txt > /tmp/users.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment