Skip to content

Instantly share code, notes, and snippets.

View hughdbrown's full-sized avatar

Hugh Brown hughdbrown

View GitHub Profile
@hughdbrown
hughdbrown / pandas-fragment.md
Last active August 29, 2015 14:27
pandas fragments

Dates

date_range

date_series = pd.date_range("start_date", "end_date")

CSV files

df = pd.read_csv("filename.csv", parse_dates=["column1"], index_col=["column2"])
@hughdbrown
hughdbrown / keybase.md
Created April 29, 2015 15:27
keybase.md

Keybase proof

I hereby claim:

  • I am hughdbrown on github.
  • I am hughdbrown (https://keybase.io/hughdbrown) on keybase.
  • I have a public key whose fingerprint is 9CD4 F942 05BA F9CC 4ABD CB31 A9D2 7566 110A B89D

To claim this, I am signing this object:

@hughdbrown
hughdbrown / pgsnap.py
Last active August 29, 2015 14:13 — forked from alq666/pgsnap.py
#!/usr/bin/env python
import os
import sys
import time
import subprocess
import urllib2
import boto
@hughdbrown
hughdbrown / knapsack.py
Last active December 30, 2015 18:09
My brute force solution for knapsack problem, http://xkcd.com/287/
weights = [215, 275, 335, 355, 420, 580]
limit = 1505
ds = {
i * w: [w] * i
for w in weights
for i in range(1, 1 + (limit // w))
}
for w in weights:
@hughdbrown
hughdbrown / sha_backup.py
Created January 17, 2011 21:23
Idea for a git-like backup program
"""
Python script to backup data in src to dst using sha1 hashes of the files
in a backing directory.
Hugh Brown
[email protected]
"""
from hashlib import sha1
import os