Skip to content

Instantly share code, notes, and snippets.

@mattalcock
mattalcock / gist:3038746
Created July 3, 2012 09:32
Single pass stats with generators in Python
import random
from math import sqrt
def compute(gen):
def stat(x):
stat.max = x if stat.max is None else stat.max
stat.min = x if stat.min is None else stat.min
stat.sum += x
stat.sum2 += x*x
@mattalcock
mattalcock / README.md
Last active October 1, 2015 04:28
python script to process images from the web very quickly

This is a markdown file to explain how the script works

@mattalcock
mattalcock / responsive_d3_example.html
Created February 22, 2012 18:42
Responsive d3.js D3 Javascript Histogram Example
!DOCTYPE html>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="https://github.com/mbostock/d3/blob/master/d3.v2.min.js"></script>
<style>
body {
font: 10px sans-serif;
}