Skip to content

Instantly share code, notes, and snippets.

@tanaka-geek
Last active March 22, 2021 10:12
Show Gist options
  • Save tanaka-geek/7b90802316bf9afc7ca6bc1c1074deb0 to your computer and use it in GitHub Desktop.
Save tanaka-geek/7b90802316bf9afc7ca6bc1c1074deb0 to your computer and use it in GitHub Desktop.
Create a list of usernames like elchapo,echapo,e.chap and stuff
#!/usr/bin/env python3
import sys
import os.path
if __name__ == "__main__":
if len(sys.argv) != 2:
print("usage: {} names.txt".format((sys.argv[0])))
sys.exit(0)
if not os.path.exists(sys.argv[1]):
print("{} not found".format(sys.argv[1]))
sys.exit(0)
filename = open(sys.argv[1]).read().replace(' ','').replace('\n','')
with open (('%s-list.txt' % filename ),'w+') as f:
with redirect_stdout(f):
for line in open(sys.argv[1]):
name = ''.join([c for c in line if c == " " or c.isalpha()])
tokens = name.lower().split()
if len(tokens) < 1:
continue
fname = tokens[0]
lname = tokens[-1]
print(fname + lname)
print(lname + fname)
print(fname + "." + lname)
print(lname + "." + fname)
print(lname + fname[0])
print(fname[0] + lname)
print(lname[0] + fname)
print(fname[0] + "." + lname)
print(lname[0] + "." + fname)
print(fname)
print(fname[0].capitalize() + lname)
print(fname[:2] + lname[:4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment