This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
backup.py | |
Create an archive which will be suitable for rsyncing to a remote backup. | |
- will not copy data unnecessarily for common operations such as | |
renaming a file or reorganising the directory structure. | |
(assumes large files are generally going to be immutable, e.g. audio/video) | |
- doesn't try to do anything fancy with permissions etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# add OSD from ArduPilotMega log file to a video | |
import sys | |
from path import path | |
from datetime import datetime, timedelta | |
from PIL import Image, ImageDraw | |
from math import sin, cos, radians | |
# STEP 1: use mplayer to extract jpgs and wav |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# kd-tree index and nearest neighbour search | |
# includes doctests, run with: python -m doctest kdtree.py | |
class KDTree(object): | |
""" | |
kd-tree spatial index and nearest neighbour search | |
http://en.wikipedia.org/wiki/Kd-tree | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
"""get svn diff and compare added functions to removed functions, | |
command line args passed through to svn diff, e.g. use -r nnn:nnn to filter a specific revision.""" | |
import sys, subprocess, re | |
from collections import defaultdict | |
svn_diff = subprocess.Popen(['svn', 'diff'] + sys.argv[1:], stdout=subprocess.PIPE).communicate()[0] | |
defn1 = "\W((?:def|class)\s+\w+)[:\(]" # python def and class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# process podcasts | |
MP3S = $(filter-out $(wildcard *.64kbit.mp3),$(wildcard *.mp3)) | |
PROCESSED = $(patsubst %.mp3,%.64kbit.mp3,$(MP3S)) | |
.PHONY: process | |
process: videos $(PROCESSED) | |
@echo Done. | |
.PHONY: videos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.6 | |
from __future__ import print_function | |
import sys | |
from scipy.stats.distributions import norm as scipy_norm | |
beta = 25/6 | |
gamma = 25/300 | |
epsilon = 0.08 |