Instantly share code, notes, and snippets.

View fourier_coefs_mex.c
#include <mex.h>
#include <math.h>
#define INDEX_TYPE_ID mxUINT8_CLASS
#define INDEX_TYPE uint8_T
void get_fourier_coefs(const double * X, const INDEX_TYPE * inds,
const double * mins, const double * ptps,
int num_pts, int dim, int num_bases, int M,
View connect-keyboard.scpt
#!/usr/bin/env osascript
-- based on http://stackoverflow.com/a/23018886/344821
tell application "System Events" to tell process "SystemUIServer"
set bt to (first menu bar item whose description is "bluetooth") of menu bar 1
click bt
tell (first menu item whose title is "CMU keyboard") of menu of bt
click
tell menu 1
if exists menu item "Connect"
click menu item "Connect"
View set_wallpaper.py
#!/usr/bin/python
'''
Script to set the OSX desktop background to the top picture from a given
subreddit.
NOTE: sets it for the current space (on all monitors), but not other spaces.
There doesn't seem to be an AppKit API to change it for all spaces.
TODO: set it in the sqlite db instead:
http://1klb.com/blog/desktop-background-on-os-x-109-mavericks.html/
View check_repodata.py
#!/usr/bin/env python
from __future__ import print_function
import json
import os
import sys
def check(path, checksum=False):
if checksum:
from conda.utils import md5_file
missing = set()
View scikit-learn rbf sampler.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View keybase.md

I hereby claim:

  • I am dougalsutherland on github.
  • I am dougalsutherland (https://keybase.io/dougalsutherland) on keybase.
  • I have a public key whose fingerprint is 8900 ABA1 C715 5902 C7E0 7DD3 D429 4787 32BA 67CC

To claim this, I am signing this object:

{
View chi2 histogram SVM example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View ssh-tunnel.sh
#!/bin/bash
SOCKS_PORT=''
LOCAL_PORT='5525'
SSH_HOST='sccs.swarthmore.edu'
TARGET_HOST='smtp.swarthmore.edu'
TARGET_PORT='25'
while getopts 'D:p:s:h:P:' OPTION
do
View hg-to-git.sh
#!/bin/sh
# hg-to-git
# sets up a clone of a remote mercurial repository to a git repo
# relies on the wonderful tools from http://repo.or.cz/w/fast-export.git
PROJ_NAME=$1
HG_REMOTE=$2
GIT_REMOTE=$3
echo "---- making the project in $PROJ_NAME"
View gist:430959
from django.core.management.base import NoArgsCommand, CommandError
from django.conf import settings
import datetime
import sys, os, os.path
DUMP_DIRECTORY = os.path.expanduser("~/db-backups/")
DUMP_PATTERN = "gazjango_%Y-%m-%d_%H-%M.sql.bz2"
class Command(NoArgsCommand):
def handle_noargs(self, **options):