Created
July 5, 2013 19:05
-
-
Save amundo/5936566 to your computer and use it in GitHub Desktop.
What .edu sites exist that are anagrams of UCSB?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Desktop/$ ./ping2.py | |
http://ucsb.edu True | |
http://ucbs.edu False | |
http://uscb.edu True | |
http://usbc.edu False | |
http://ubcs.edu False | |
http://ubsc.edu False | |
http://cusb.edu False | |
http://cubs.edu False | |
http://csub.edu True | |
http://csbu.edu False | |
http://cbus.edu False | |
http://cbsu.edu False | |
http://sucb.edu False | |
http://subc.edu False | |
http://scub.edu False | |
http://scbu.edu True | |
http://sbuc.edu False | |
http://sbcu.edu False | |
http://bucs.edu False | |
http://busc.edu False | |
http://bcus.edu False | |
http://bcsu.edu False | |
http://bsuc.edu False | |
http://bscu.edu False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 | |
import sys | |
sys.path.append('/usr/local/lib/python2.7/site-packages/') | |
import requests | |
import itertools | |
urls = [''.join(x) for x in list(itertools.permutations(list('ucsb')))] | |
def ping(host): | |
try: | |
res = requests.get(host) | |
return True | |
except requests.exceptions.ConnectionError: | |
return False | |
for u in urls: | |
q = 'http://' + u + '.edu' | |
yesno = str(ping(q)) | |
print( q + '\t' + yesno) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment