Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# Mathieu Blondel, October 2010 | |
# License: BSD 3 clause | |
import numpy as np | |
from numpy import linalg | |
def linear_kernel(x1, x2): | |
return np.dot(x1, x2) | |
def polynomial_kernel(x, y, p=3): |
"""Usage: python matchcolors.py good.jpg bad.jpg save-corrected-as.jpg""" | |
from scipy.misc import imread, imsave | |
from scipy import mean, interp, ravel, array | |
from itertools import izip | |
import sys | |
def mkcurve(chan1,chan2): | |
"Calculate channel curve by averaging target values." | |
fst = lambda p: p[0] |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
o o o | |
o x | |
o x x x | |
x o | |
x x x o | |
x | |
o o | |
o | |
#!/bin/sh | |
# btsync service | |
# Replace with linux users you want to run BTSync clients for | |
BTSYNC_USERS="mendel" | |
DAEMON=/usr/bin/btsync | |
start() { | |
for btsuser in $BTSYNC_USERS; do | |
HOMEDIR=`getent passwd $btsuser | cut -d: -f6` | |
config=$HOMEDIR/.sync/config.json |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Prerequisites:
Software components used:
#!/usr/bin/env python | |
"""strip outputs from an IPython Notebook | |
Opens a notebook, strips its output, and writes the outputless version to the original file. | |
Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS. | |
This does mostly the same thing as the `Clear All Output` command in the notebook UI. | |
LICENSE: Public Domain |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
reveal-svg-fragment.js
as a dependency<section>
of reveal.js markupdata-svg-fragment=""
to something, e.g.