Skip to content

Instantly share code, notes, and snippets.

View dangoldin's full-sized avatar

Dan Goldin dangoldin

View GitHub Profile
@dangoldin
dangoldin / stats_analysis.py
Created January 11, 2015 23:23
Python script to do a quick analysis of my 2014 stats
import csv, re
from collections import namedtuple, Counter
cols = ['date', 'dow', 'hours_slept', 'mood_morning', 'mood_day', 'mood_evening', 'breakfast', 'lunch', 'dinner', 'drinks', 'snacks', 'coffee', 'weight']
StatDay = namedtuple('StatDay', cols)
RE_NON_WORD = re.compile('\W+')
RE_NUM = re.compile('\d+')
@dangoldin
dangoldin / ticketing.txt
Created March 3, 2012 02:59
Ticket checking vs fining
N = number of passengers
p = ticket price
c = % of passengers that will be checked for a ticket
v = % of passengers that are violators
F = fine
Np = Np(1-c)(1-v) + Npc(1-v) + Ncv*F
Solving for F, we get that F = p/c.