Skip to content

Instantly share code, notes, and snippets.

@thomie
thomie / gist:f798e3c5207dc6500e77
Created December 18, 2015 18:44
GHC contributors, listed by year of last commit
Contributors, listed by year of last commit
=== 2015 ===
* Simon Marlow (11282)
* Simon Peyton Jones (8049)
* Austin Seipp (697)
* Herbert Valerio Riedel (605)
* Edward Z. Yang (486)
* David Terei (484)
* Joachim Breitner (415)
@thomie
thomie / gist:4018e5abec5e207d1889
Created December 18, 2015 18:18
GHC contributors, listed by year of first contribution
Contributors, listed by year of first commit
=== 2015 ===
* Matthew Pickering (24)
* Bartosz Nitka (23)
* Ryan Scott (21)
* Tamar Christina (19)
* David Kraeutmann (8)
* Adam Sandberg Eriksson (7)
@thomie
thomie / gist:a7878a585ca9c429ed6d
Last active December 18, 2015 17:56
Number of GHC contributors and newcomers per year
Number of contributors per year
1996 5
1997 7
1998 5
1999 10
2000 18
2001 23
2002 25
2003 22
2004 18
@thomie
thomie / coroutines.py
Last active December 15, 2015 20:49
Coroutines in Python
# Simple Generators
# http://www.python.org/dev/peps/pep-0255/
def producer():
a, b = 0, 1
while True:
a, b = b, a + b
yield a
def pull():
p = producer()
@thomie
thomie / gist:5247145
Last active December 15, 2015 10:39 — forked from dxlbnl/gist:5245302
## Prelude.
from functools import partial
from itertools import chain, ifilter, islice, izip_longest
def compose(*funcs):
"""Return a function such that compose(a,b,c)(arg1, arg2, arg3)
is equivalent to a(b(c(arg1, arg2, arg3)))."""
# See http://bugs.python.org/issue1660179
def _composefunc(*args, **kw):
@thomie
thomie / double-dispatch.cpp
Created July 25, 2012 11:28
Double dispatch in C++
#include <stdio.h>
/* Forward declarations. */
class Structure;
class Plane;
class Cylinder;
void print2(Cylinder*, Plane*);
void print2(Plane*, Cylinder*);
void print2(Cylinder*, Cylinder*);
void print2(Plane*, Plane*);
@thomie
thomie / unique_permutations.pl
Created June 4, 2011 15:37
Unique permutations
# Generate all unique permutations of an array
# with possibly duplicate elements (multiset).
# unique_permutations(('A', 'B', 'B')) -> ABB BAB BBA
sub unique_permutations
{
my @results;
my (@list) = @_;
if ($#list == -1) {
return [()];
@thomie
thomie / self-replication.py
Created June 2, 2011 17:03
Self replicating code
x = 'print "x = " + chr(39) + x + chr(39) + "; exec(x)"'; exec(x)
@thomie
thomie / rename-greens-functions.sh
Created August 18, 2010 09:13
Rename Green's functions
#!/bin/sh
FILES='
Makefile.am
*.hpp
*.cpp
*.py
test/Makefile.am
test/*.cpp
test/*.py
=====> T9586(normal) 4434 of 4635 [0, 3, 0]
Compile failed (status 256) errors were:
[1 of 1] Compiling Main ( T9532.hs, T9532.o )
ghc.exe: getMBlocks: VirtualAlloc MEM_COMMIT failed: The paging file is too small for this operation to complete.
*** unexpected failure for T9532(normal)
=====> T9681(normal) 4435 of 4635 [0, 4, 0]
timeout.exe: failed to create OS thread: The paging file is too small for this operation to complete.
264 [main] python2 5016 fhandler_dev_zero::fixup_mmap_after_fork: requested 0x6FFFD8A0000 != 0x0 mem alloc base 0x0, state 0x10000, size 132997997330432, Win32 error 1455
513 [main] python2 5016 C:\msys64\usr\bin\python2.exe: *** fatal error in forked process - recreate_mmaps_after_fork_failed