Skip to content

Instantly share code, notes, and snippets.

View plux's full-sized avatar

Håkan Nilsson plux

View GitHub Profile

fafdaojoi

@plux
plux / 4.txt
Last active November 18, 2015 09:35
Four 4s
% 4 4 4 4
tools =
0 = floor(.4)
1 = ceil(.4)
2 = sqrt(4)
3 = ceil(sqrt(sqrt(4!)))
5 = ceil(sqrt(4!))
6 = gamma(4) OR ceil(sqrt(sqrt(4!)))!
7 = ceil(sqrt(44))
24 = 4!
@plux
plux / random_imgur.py
Created July 13, 2012 20:59
random imgur tinyer
import os,random,string,sys,urllib2
n=5if len(sys.argv)<2 else int(sys.argv[1])
while n>0:
s=''.join(random.sample(string.letters+string.digits,5))+'.jpg'
i=urllib2.urlopen('http://i.imgur.com/'+s).read()
if len(i)!=503:n-=1;open('output/'+s,'wb').write(i)
@plux
plux / random_imgur.py
Created July 13, 2012 20:40
random_imgur tiny
import os, random, string, sys, urllib2
num_pics = 5
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
trailingZeroesInNibble(0) ->
4;
trailingZeroesInNibble(1) ->
0;
trailingZeroesInNibble(2) ->
1;
trailingZeroesInNibble(3) ->
0;
trailingZeroesInNibble(4) ->
2;