Skip to content

Instantly share code, notes, and snippets.

@bwhitman
bwhitman / CoreMotion.m
Last active July 6, 2016 03:53
Example output and query code for the historical "M7" data from CMMotionActivityManager
/*
2013-09-29 21:23:26.468 perf[3911:60b] Sep 26, 2013, 8:47 AM confidence high type walking steps 16
2013-09-29 21:23:26.469 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 0
2013-09-29 21:23:26.471 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type steps 0
2013-09-29 21:23:26.472 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence low type walking steps 0
2013-09-29 21:23:26.474 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence medium type walking steps 0
2013-09-29 21:23:26.475 perf[3911:60b] Sep 26, 2013, 8:56 AM confidence high type walking steps 341
2013-09-29 21:23:26.476 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence high type walking steps 6
2013-09-29 21:23:26.478 perf[3911:60b] Sep 26, 2013, 9:04 AM confidence low type steps 18
2013-09-29 21:23:26.480 perf[3911:60b] Sep 26, 2013, 9:05 AM confidence low type steps 6
@bwhitman
bwhitman / perf.c
Last active December 24, 2015 06:09
FFT performance on the 5s 64-bit mode vs. 32-bit mode
/*
100,000 iterations of a 1024 point real->imag FFT, computing magnitude & phase and then its inverse again
Run twice, once with double precision and then again using the single precision float vDSP
5s in 32 bit mode
2013-09-29 13:48:47.009 perf[3513:60b] doFFT double precision took 157.924796 seconds
2013-09-29 13:49:13.707 perf[3513:60b] doFFT single precision took 26.697247 seconds
5s in 64 bit mode
2013-09-29 13:51:47.402 perf[3524:60b] doFFT double took 57.861582 seconds (2.7x speedup over 32-bit mode)
@bwhitman
bwhitman / gist:6263131
Created August 18, 2013 18:17
Suggestions for the Echo Nest Softball Team Name
What's on Second
Itsamateursecco
The Ghost Tracks
Marni & The Greenbergs
I Can't Believe The Echo Nest Has a Softball Team
Family Game Night
The Sonos Whiplash
Echo Best
The Taste Profiles
reallyhit()
@bwhitman
bwhitman / gist:5897843
Created July 1, 2013 01:39
From Dark Harbor by Mark Strand
I
When after a long silence one picks up the pen
And leans over the paper and says to himself:
Today I shall consider Marsyas
Whose body was flayed to an excess
Of nakedness, who made no crime that would square
With what he was made to suffer.
Today I shall consider the shredded remains of Marsyas
What do they mean as they gather the sunlight
@bwhitman
bwhitman / gist:5807743
Created June 18, 2013 17:59
The Wood Sprite by Vladimir Nabokov

I was pensively penning the outline of the inkstand's circular, quivering shadow. In a distant room a clock struck the hour, while I, dreamer that I am, imagined someone was knocking at the door, softly at first, then louder and louder. He knocked twelve times and paused expectantly.

"Yes, I'm here, come in..."

The door knob creaked timidly, the flame of the runny candle tilted, and he hopped sidewise out of a rectangle of shadow, hunched, gray, powdered with the pollen of the frosty, starry night.

I knew his face - oh, how long I had known it!

His right eye was still in the shadows, the left peered at me timorously, elongated, smoky-green. The pupil glowed like a point of rust....That mossy-gray tuft on his temple, the pale-silver, scarcely noticeable eyebrow, the comical wrinkle near his whiskerless mouth - how all this teased and vaguely vexed my memory!

@bwhitman
bwhitman / gist:5807716
Created June 18, 2013 17:55
From Mason & Dixon, Thomas Pynchon

When they leave the Cape, no one is there at the Quay to say good-bye but Bonk, the police official who earlier greeted them. "Good luck, Fellows. Tell them at the Desk, I was not such a bad Egg, no?"

"What Desk is that," ask Mason and Dixon.

"What Desk? In London, off some well-kept Street, in a tidy House, there will be someone at a Desk, to whom you'll tell all you have seen."

"Not in England, Sir," Mason protests.

For the first and final time they see him laugh, and glimpse an entire Life apart from the Castle, in which he must figure as a jolly Drinking Companion. "You'll see!" he calls as they depart for the Ship in the Bay. "Good Luck, Good Luck! Ha! Ha! Ha!" Resounding upon the Water ever-widening between them.

@bwhitman
bwhitman / gist:5654452
Created May 26, 2013 23:36
Opening lines of "Pale Fire"
I was the shadow of the waxwing slain
By the false azure in the windowpane;
I was the smudge of ashen fluff - and I
Lived on, flew on, in the reflected sky.
And from the inside, too, I'd duplicate
Myself, my lamp, an apple on a plate:
Uncurtaining the night, I'd let dark glass
Hang all the furniture above the grass,
And how delightful when a fall of snow
Covered my glimpse of lawn and reached up so
@bwhitman
bwhitman / gist:5561476
Last active December 17, 2015 05:58
From The Recognitions, William Gaddis

--I don't know. Never mind, he said lowering his eyes again. --It's just that I... sometimes I feel my face and... or I feel myself moving or looking at something in a way that I... well never mind, never mind that. Never mind it then.

Suggestion of the smile she had not smiled faded from her face, and quiety she said, --All right.

—-But no, I mean, I don’t know. Sometimes I do, sometimes I almost do, and then I lose it. Like a story I heard once, a friend of mine told me, somebody I used to know, a story about a forged painting. It was a forged Titian that somebody had painted over another old painting, when they scraped the forged Titian away they found some worthless old painting underneath it, the forger had used it because it was an old canvas. But then there was something under that worthless painting, and they scraped it off and underneath that they found a Titian, a real Titian that had been there all the time. It was as though when the forger was working, and he didn’t know the original was underne

@bwhitman
bwhitman / gist:5373828
Last active December 16, 2015 03:59
King of Jazz by Donald Barthelme

Well I'm the king of jazz now, thought Hokie Mokie to himself as he oiled the slide on his trombone. Hasn't been a 'bone man been king of jazz for many years. But now that Spicy MacLammermoor, the old king, is dead, I guess I'm it. Maybe I better play a few notes out of this window here, to reassure myself.

"Wow!" said somebody standing on the sidewalk. "Did you hear that?"

"I did," said his companion.

"Can you distinguish our great homemade American jazz performers, each from the other?"

"Used to could."

@bwhitman
bwhitman / gist:5333712
Created April 8, 2013 02:17
The Soniferous Aether, from "Gravity's Rainbow" by Thomas Pynchon

Imagine this very elaborate scientific lie: that sound cannot travel through outer space. Well, but suppose it can. Suppose They don’t want us to know there is a medium there, what used to be called an “aether,” which can carry sound to every part of the Earth. The Soniferous Aether. For millions of years, the sun has been roaring, a giant, furnace, 93 million mile roar, so perfectly steady that generations of men have been born into it and passed out of it again, without ever hearing it. Unless it changed, how would anybody know?

Except that at night now and then, in some part of the dark hemisphere, because of eddies in the Soniferous Aether, there will come to pass a very shallow pocket of no-sound. For a few seconds, in a particular place, nearly every night somewhere in the World, sound-energy from Outside is shut off. The roaring of the sun stops. For its brief life, the point of sound-shadow may come to rest a thousand feet above a desert, between floors in an empty office building, or exactly around