Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am mariokonschake on github.
  • I am mariokonschake (https://keybase.io/mariokonschake) on keybase.
  • I have a public key ASCPwauc6dzYbEkBI4vXB7wTkbhIKMVwbENhO3fcnodvOQo

To claim this, I am signing this object:

82.100.213.130
62.157.39.4
79.237.124.97
79.193.104.100
87.138.115.99
91.64.123.147
37.5.6.120
95.90.234.207
91.23.31.23
178.5.182.14
{
"IAB1": "Arts & Entertainment",
"IAB1-1": "Books & Literature",
"IAB1-2": "Celebrity Fan/Gossip",
"IAB1-3": "Fine Art",
"IAB1-4": "Humor",
"IAB1-5": "Movies",
"IAB1-6": "Music",
"IAB1-7": "Television",
"IAB2": "Automotive",
@mariokonschake
mariokonschake / gist:7992941
Created December 16, 2013 19:33
psql-to-csv
#/bin/bash
echo "copy ($@) to stdout with CSV HEADER;" | psql
cat user-agents.txt | sed -r 's/.*(MSIE [0-9]+\.[0-9]|Firefox\/[0-9]+|Safari\/[0-9]|Opera\/[0-9]+).*/\1/'
@mariokonschake
mariokonschake / shell-histogram
Created January 28, 2013 13:56
A quick histogram in the shell. (Keep forgetting it.)
zcat file | sort | uniq -c | sort -nr
@mariokonschake
mariokonschake / histogram-query.sql
Created December 11, 2012 15:36
Query a histogram of prices in postgres (number of bis = 20)
SELECT
(
(VALUES ((SELECT max(price/20) FROM prices))) * bin
)::float AS lower_bin_edge,
COALESCE(count, 0) AS count
FROM (
SELECT
floor(
price /
(VALUES ((SELECT max(price/20) FROM prices)))
@mariokonschake
mariokonschake / latency.txt
Created May 31, 2012 09:17 — forked from jboner/latency.txt
Latency numbers every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns
Mutex lock/unlock 25 ns
Main memory reference 100 ns
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns