Skip to content

Instantly share code, notes, and snippets.

@dmcdougall
dmcdougall / latency.txt
Created June 1, 2012 10:45 — 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 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 1 MB sequentially from memory 250,000 ns 0.25 ms
Round trip within same datacenter 500,000 ns 0.5 ms
Read 1 MB sequentially from SSD 1,000,000 ns 1 ms 4X memory
@dmcdougall
dmcdougall / aliases
Created July 5, 2012 18:52 — forked from kaleb/aliases
Gmail on Mutt
#~/.mutt/aliases
alias nick Nicholas Levandoski <[email protected]>
alias tim Timothy Pitt <[email protected]>
alias steven Steven Jackson <[email protected]>
alias kaleb Kaleb Hornsby <[email protected]>
alias alug-admin nick, tim, steven
@dmcdougall
dmcdougall / plot-colours.py
Created July 20, 2012 10:37
Plot lots of graphs with different colours
from pylab import *
import matplotlib.cm as cm
x = linspace(0, 2*pi, num=100, endpoint=True)
for i in range(1, 10):
plot(x, sin(x + pi*i/10.0), color=cm.jet(i/10.0))
show()
@dmcdougall
dmcdougall / _chi2.c
Created August 10, 2012 10:26 — forked from dfm/_chi2.c
How to wrap C code in Python
#include <Python.h>
#include <numpy/arrayobject.h>
#include "chi2.h"
/* Docstrings */
static char module_docstring[] =
"This module provides an interface for calculating chi-squared using C.";
static char chi2_docstring[] =
"Calculate the chi-squared of some data given a model.";
@dmcdougall
dmcdougall / new_bashrc.sh
Created August 11, 2012 07:33 — forked from josephwecker/new_bashrc.sh
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful.
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?
# Are you tired of trying to remember how darwin/mac-osx treat them differently from linux?
# Are you tired of not having your ~/.bash* stuff work the way you expect?
#
# Symlink all of the following to this file:
# * ~/.bashrc
@dmcdougall
dmcdougall / new_boxplot_method.py
Created September 3, 2012 12:10
New boxplot features
def boxplot(self, x, notch=0, sym='+', vert=1, whis=1.5,
positions=None, widths=None, means=0, fill=0,
linestyle='-', monochrome=0, limits=None,
notchsize=None):
"""
boxplot(x, notch=0, sym='+', vert=1, whis=1.5,
positions=None, widths=None, means=0, fill=0,
linestyle='-', monochrome=0, limits=None,
notchsize=None)
@dmcdougall
dmcdougall / diff_output.txt
Created September 17, 2012 11:00
Diff output from v0.90
1,2c1,4
< def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
< positions=None, widths=None):
---
> def boxplot(self, x, notch=0, sym='+', vert=1, whis=1.5,
> positions=None, widths=None, means=0, fill=0,
> linestyle='-', monochrome=0, limits=None,
> notchsize=None):
5c7,9
< positions=None, widths=None)
@dmcdougall
dmcdougall / axes (boxplot method).py
Created September 17, 2012 11:01
Axes boxplot method
def boxplot(self, x, notch=0, sym='b+', vert=1, whis=1.5,
positions=None, widths=None, means=0, dofill=1,
linestyle='-', monochrome=0, limits=None):
"""
boxplot(x, notch=0, sym='+', vert=1, whis=1.5,
positions=None, widths=None, means=0, dofill=1,
linestyle='-', monochrome=0, limits=None)
Make a box and whisker plot for each column of x.
The box extends from the lower to upper quartile values
@dmcdougall
dmcdougall / new_boxplot_method.py
Created September 17, 2012 11:02
New boxplot method
def boxplot(self, x, notch=0, sym='+', vert=1, whis=1.5,
positions=None, widths=None, means=0, fill=0,
linestyle='-', monochrome=0, limits=None,
notchsize=None):
"""
boxplot(x, notch=0, sym='+', vert=1, whis=1.5,
positions=None, widths=None, means=0, fill=0,
linestyle='-', monochrome=0, limits=None,
notchsize=None)
@dmcdougall
dmcdougall / email.txt
Created September 17, 2012 11:05
Nabble boxplot email
Dear matplotlib developers,
I am attaching an updated boxplot method for axes.py that I would like
to suggest as a replacement for the present one in 0.90. My code does
not change any of the existing functionality, and simply adds a few
options to the existing code:
* I wanted to be able to draw boxplots entirely in black.
* When plotting several boxes on the same axes, where some boxes are