Skip to content

Instantly share code, notes, and snippets.

@cod3monk
Created January 8, 2017 17:19
Show Gist options
  • Save cod3monk/3062aa383320a65fb3adfdfb90e7c7f8 to your computer and use it in GitHub Desktop.
Save cod3monk/3062aa383320a65fb3adfdfb90e7c7f8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import sys, re, webbrowser, time, random as r
from urllib.request import urlopen
url = "http://icpc.cs.fau.de/anmeldung.php"
def joined_icpc(team):
p = urlopen(url).read().decode('u8')
return (team in re.findall('D>\n([^<>]+)</T', p))
if __name__ == '__main__':
so = sys.stdout
so.write("CAN HAZ team name: "); so.flush()
team = sys.stdin.readline()[:-1]
if not joined_icpc(team): webbrowser.open(url)
while not joined_icpc(team):
so.write(chr(122-r.randrange(2)*0x20))
so.flush(); time.sleep(1)
print("\nKTHXBYE!!1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment