Skip to content

Instantly share code, notes, and snippets.

@swirepe
swirepe / gamma_trick.sh
Created June 2, 2017 00:15 — forked from marcan/gamma_trick.sh
Two images in one using the PNG gamma header trick.
#!/bin/sh
# PNG Gamma trick (by @marcan42 / marcan@marcan.st)
#
# This script implements an improved version of the gamma trick used to make
# thumbnail images on reddit/4chan look different from the full-size image.
#
# Sample output (SFW; images by @Miluda):
# https://mrcn.st/t/homura_gamma_trick.png
# https://www.reddit.com/r/test/comments/6edthw/ (click for fullsize)
# https://twitter.com/marcan42/status/869855956842143744
@swirepe
swirepe / lcr.py
Last active December 19, 2015 15:49
LCR
# let's play LCR!
# http://en.wikipedia.org/wiki/LCR_(dice_game)
from random import choice, shuffle, random
def makeDie(L=1,C=1,R=1,D=3):
print "Making a die with " + str(L + C + R + D) + " sides."
die = ([-1] * L) + (["pot"] * C) + ([1] * R) + ([0] * D)
return die
@swirepe
swirepe / gist:4703275
Last active December 12, 2015 02:58
Bloom Filter in python (see https://gist.github.com/4700640)
from bitarray import bitarray
import mmh3
# gist adapted from mburst's work
# https://gist.github.com/4700640
# using this dictionary:
# http://manpages.ubuntu.com/manpages/precise/man5/american-english-huge.5.html
# comments on reddit