Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
View gist:e453d907b0dd25e8093d
### Keybase proof
I hereby claim:
* I am kylemcdonald on github.
* I am kylemcdonald ( on keybase.
* I have a public key whose fingerprint is 50DA 00A9 1EB3 C84D 7A56 9FAD 3ACA C174 01F5 8612
To claim this, I am signing this object:
kylemcdonald / main.cpp
Last active August 29, 2015 14:02
Playing with path optimization ideas.
View main.cpp
#include "ofMain.h"
#include "ofxCv.h"
class ofApp : public ofBaseApp {
void setup() {
bestDiff = 0;
swaps = 64 * 64;
n = 32;
for(int y = 0; y < n; y++) {
kylemcdonald / Matlab.pde
Last active August 29, 2015 14:02
Lomb-Scargle periodogram for Processing, ported from Matlab code, so it's very idiosyncratic and non-idiomatic. Original code published in "Ice Ages and Astronomical Causes: Data, Spectral Analysis and Mechanisms" available at
View Matlab.pde
float[] hann(float[] x) {
int n = x.length;
float[] result = new float[n];
for(int i = 0; i < n; i++) {
float weight = .5 * (1 - cos((TWO_PI * i) / (n - 1)));
result[i] = x[i] * weight;
return result;
kylemcdonald / BrowseCapture.scpt
Created June 25, 2014 23:40
Records video from your webcam whenever you are visiting a specific site.
View BrowseCapture.scpt
global targetDomain
global folderName
-- options
set targetDomain to ""
set folderName to (path to desktop as text) & "Dropcam"
-- main code
global recordingFile
global newMovieRecording
kylemcdonald /
Last active August 29, 2015 14:05
Scrape a list of Spotify track IDs for JSON and preview URLs. Can handle very large lists of tracks by using subdirectories based on the track ID. Picks up where it lefts off. Ignores errors during downloading.
#!/usr/bin/env python
import json, urllib
import os.path
import subprocess
import argparse
from subprocess import call
parser = argparse.ArgumentParser(
description='Scrape a list of Spotify track IDs for JSON and preview URLs.')
kylemcdonald / recruiting
Created September 2, 2014 19:51
Form response to recruiting emails.
View recruiting
MIME-Version: 1.0
Date: Tue, 2 Sep 2014 15:36:38 -0400
Subject: Re: Introducing ████████
From: Kyle McDonald <>
To: ███████ █████ <███████@█████████.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
kylemcdonald /
Last active August 29, 2015 14:06
liberator variations: the englishman


I've been asked to produce a print of this piece for an exhibition:

Unfortunately the image was made from a model that was only meant to be rendered, not printed.

kylemcdonald /
Created September 24, 2014 22:04
Shows anything sent over POST.
import time
import BaseHTTPServer
import cgi
from pprint import pprint
HOST_NAME = 'localhost'
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
kylemcdonald / 1024x768-grid.png
Last active August 29, 2015 14:07
Keystone check script for Processing.
kylemcdonald / gcd.cpp
Last active August 29, 2015 14:07
Grand central dispatch examples courtesy of @HalfdanJ
View gcd.cpp
// group of for loops with waiting
int m, n;
dispatch_group_t group = dispatch_group_create();
dispatch_group_async(group, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,0), ^{
// before all parallel m
dispatch_apply(m, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^(size_t i) {
// parallel m code with i for index
// after all parallel m