Skip to content

Instantly share code, notes, and snippets.

@w4
Last active December 1, 2015 16:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w4/e4907ccc9f6c1bb49b17 to your computer and use it in GitHub Desktop.
Save w4/e4907ccc9f6c1bb49b17 to your computer and use it in GitHub Desktop.
Scan through combinations of github names and check the availability of said names
from itertools import product
from sys import argv
from random import shuffle
from urllib.request import urlopen
from urllib.error import HTTPError
def main(args):
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
combinations = [''.join(i) for i in product(letters, repeat=(int(args[1]) if len(args) > 1 else 2))]
shuffle(combinations)
for username in combinations:
try:
urlopen('https://github.com/' + username)
except HTTPError:
print(username + " is available!")
if __name__ == '__main__':
main(argv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment