Skip to content

Instantly share code, notes, and snippets.

View noncombatant's full-sized avatar

Chris Palmer noncombatant

View GitHub Profile
@noncombatant
noncombatant / maybe_gzip_reader.go
Last active June 17, 2020 01:20
MaybeGzipReader
package maybegzip
import (
"compress/gzip"
"io"
"os"
)
// Provides an io.Reader that might or might not refer to a gzipped file. If it
// is a gzipped file, reading from the io.Reader transparently decompresses the
@noncombatant
noncombatant / demo.py
Created April 20, 2016 22:34
Microbenchmark for different collection types in Python. What do you expect to happen?
def set_up_test(count):
l = []
d = {}
s = set()
for i in range(count):
l.append(i)
d[i] = True
s.add(i)
return l, d, s