Skip to content

Instantly share code, notes, and snippets.

@professorjamesmoriarty
Created October 3, 2015 21:31
Show Gist options
  • Save professorjamesmoriarty/854a1b2f4a4ade96f83e to your computer and use it in GitHub Desktop.
Save professorjamesmoriarty/854a1b2f4a4ade96f83e to your computer and use it in GitHub Desktop.
import os, random, string, sys, urllib2
num_pics = 1
if len(sys.argv) > 1:
num_pics = int(sys.argv[1])
while num_pics > 0:
name = ''.join(random.sample(string.letters+string.digits, 5)) + '.jpg'
img = urllib2.urlopen("http://i.imgur.com/" + name).read()
if len(img) != 503: # 'image not found' is 503 bytes
num_pics -= 1
print "http://i.imgur.com/"+ name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment