Skip to content

Instantly share code, notes, and snippets.

@bwhitman
bwhitman / OAMutableURLRequest.m
Created November 29, 2011 14:03
OAMutableURLRequest.m
//
// OAMutableURLRequest.m
// OAuthConsumer
//
// Created by Jon Crosby on 10/19/07.
// Copyright 2007 Kaboomerang LLC. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
find ~/Music/iTunes/iTunes\ Media/ \( -name "*.mp3" -o -name "*.m4a" \) > all_files
./codegen.Darwin -s 10 30 < all_files > all_codes
@bwhitman
bwhitman / gist:1563427
Created January 5, 2012 02:37
Example codegen output for multiple files
[
{"error":"could not decode", "tag":13530, "metadata":{"filename":"/Users/bwhitman/Music/iTunes/iTunes Media/Music//Zeta Reticula/Balance 005 (CD1)/04 - Tool 1.mp3"}},
{"metadata":{"filename":"/Users/bwhitman/Music/iTunes/iTunes Media/Music//Zongamin/Unknown Album/02 Third Uncle.mp3", "samples_decoded":661816, "given_duration":30, "start_offset":10, "version":4.12, "patch":"d", "codegen_time":0.549810, "decode_time":1.124349}, "code_count":1116, "code":"eJxdlguSJCkMQ6-SRwDb-HP_i-0TWbXbtTERM-0mAVmSxeTO8DnVz0zH0-67tvt59toRT_msvXcUtXtS92z-BHXMv_VSneen3mv1s3uvyiyj9lycbxW5K6lrm9Z3tq9FPUv3tVeEsW72Pa-P9lvsn_Ot8ud8G-vPfiHdbtF_93vw95_9XvNTx96_9bH-qf_X31F_f2uji781v4CV4zG3tX3U8ET1XKg7l9tjwFjeB4C5X0Bh076pWwSPR4T02WVbtFmuFLPlsDiRXQduqA9dj4GrJE8Vdxw_sw3Oqbv76e07hw0Qt3o9wf7yWKy3xeL79HViI3_HuvCPD9Jow0mpdDDMXS_sYtnBCUtCctGTcZDZdf8lgfuQScLRWwbrK-ycYv-E6IzANjVDnR950dm5aAD45ICWfrU-khu3pIDZ2kLTy_PwBbXRXu3j2LK0Hi20tOH3c3Y9-OqsGdAZ_4DWT-c1s9HX1SaaL1S7zClPIM4jUr_NHsCaUDxD4zGGV03kXLJaN3Kf8KnbTJOZjV8093Nq1OZA87zmgW4-eOR1wbVVq7ScdHMnr
@bwhitman
bwhitman / gist:1563459
Created January 5, 2012 02:42
pyechonest example for FP querying
#!/usr/bin/env python
import json
import pyechonest.song as song
if __name__ == '__main__':
# Open that big code file that codegen created
allofit = json.load(open('all_codes'))
for query in allofit:
if query.has_key("code"):
@bwhitman
bwhitman / gist:1989702
Created March 6, 2012 23:18
Axolotl by Julio Cortazar

There was a time when I thought a great deal about the axolotls. I went to see them in the aquarium at the Jardin des Plantes and stayed for hours watching them, observing their immobility, their faint movements. Now I am an axolotl.

I got to them by chance one spring morning when Paris was spreading its peacock tail after a wintry Lent. I was heading down tbe boulevard Port-Royal, then I took Saint-Marcel and L'Hôpital and saw green among all that grey and remembered the lions. I was friend of the lions and panthers, but had never gone into the dark, humid building that was the aquarium. I left my bike against tbe gratings and went to look at the tulips. The lions were sad and ugly and my panther was asleep. I decided on the aquarium, looked obliquely at banal fish until, unexpectedly, I hit it off with the axolotls. I stayed watching them for an hour and left, unable to think of anything else.

In the library at Sainte-Geneviève, I consulted a dictionary and learned that axolotls are the larval st

@bwhitman
bwhitman / gist:2038886
Created March 14, 2012 19:34
The Stockturm. Long-Distance Song Effects from "The Tin Drum" by Günter Grass

The Stockturm. Long-Distance Song Effects

Dr. Hornstetter, the lady doctor who drops in on me almost every day just long enough to smoke a cigarette, who is supposed to be taking care of me but who, thanks to my treatment, leaves the room after every visit a little less nervous than she was when she came, a retiring sort who is intimate only with her cigarettes, keeps insisting that I suffered from isolation in my childhood, that I didn’t play enough with other children. Well, as far as other children are concerned, she may be right. It is true that I was so busy with Gretchen Scheffler’s lessons, so torn between Goethe and Rasputin, that even with the best of intentions I could have found no time for ring-around-a-rosy or post office. But whenever, as scholars sometimes do, I turned my back on books, declaring them to be the graveyards of the language, and sought contact with the simple folk, I encountered the little cannibals who lived in our building, and after brief association with them, felt very glad

function makePlaylistFromNowPlaying() {
var playerTrackInfo = sp.trackPlayer.getNowPlayingTrack();
if (playerTrackInfo == null) {
info("Start playing something and I'll make a playlist of good songs based on that song");
} else {
var track = playerTrackInfo.track;
fetchPlaylist(track.artists[0], 25);
}
}
@bwhitman
bwhitman / gist:3185350
Created July 27, 2012 00:16
The Library of Babel by Jorge Luis Borges

By this art you may contemplate the variations of the 23 letters...

--The Anatomy of Melancholy, part 2, sect. II, mem. IV

The universe (which others call the Library) is composed of an indefinite and perhaps infinite number of hexagonal galleries, with vast air shafts between, surrounded by very low railings. From any of the hexagons one can see, interminably, the upper and lower floors. The distribution of the galleries is invariable. Twenty shelves, five long shelves per side, cover all the sides except two; their height, which is the distance from floor to ceiling, scarcely exceeds that of a normal bookcase. One of the free sides leads to a narrow hallway which opens onto another gallery, identical to the first and to all the rest. To the left and right of the hallway there are two very small closets. In the first, one may sleep standing up; in the other, satisfy one's fecal necessities. Also through here passes a spiral stairway, which sinks abysmally and soars upwards to remote distances. In the h

@bwhitman
bwhitman / gist:3257113
Created August 4, 2012 12:20
tilemill problem
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
node.js:201
@bwhitman
bwhitman / gist:3932751
Created October 22, 2012 17:22
The New Owner by Donald Barthelme

The New Owner by Donald Barthelme

When he came to look at the building, with a real-estate man hissing and oozing beside him, we lowered the blinds, muted or extinguished lights, threw newspapers and dirty clothes on the floor in piles, burned rubber bands in ashtrays, and played Buxtehude on the hi-fi-shaking organ chords whose vibrations made the plaster falling from the ceiling fall faster. The new owner stood in profile, refusing to shake hands or even speak to us, a tall thin young man suited in hopsacking with a large manila envelope under one arm. We pointed to the plaster, to the crevasses in the walls, sagging ceilings, leaks. Nevertheless, he closed.

Soon he was slipping little rent bills into the mailboxes, slip slip slip slip. In sixteen years we’d never had rent bills but now we have rent bills. He’s raised the rent, and lowered the heat. The owner creeps into the house by night and takes the heat away with him. He wants us out, out. If we were gone, the building would be decontrolled. The rent