mikey's blog!
 
tech industry cynicism
observations through code
unsolicited product advice
 
 
subscribe
test
2 years ago

lol

 
three mongodb talks i did recently
2 years ago

message queues


aggregation framework

replica sets


 
python+wfmu+spotify+mongoDB = ♪┏(⌒-⌒)┛♬
2 years ago

i'm a fan of wfmu which also happens to be one of the few radio stations that has archives of actual playlists from their programs.

using BeautifulSoup and spotimeta i wrote some python (here: http://git.io/Augf7Q) to scrape artist/title information from the archives, find a "best guess" match in the catalog, and generate nice readable HTML with clickable links that play the songs in Spotify.

it also keeps all that metadata in a MongoDB collection, so adding things like searching, tagging, or analytics will be easy.

it's turned out to be a nice way to find new stuff to listen to. i seeded it with only a few URLs and got back about 800 tracks pretty quickly. with some more parsing/scraping logic it would be easy to pull data from other radio sites as well.

here's a few rows of sample output: (btw, you need spotify to actually click on those links, duhhh)

God Knows (You Gotta Give to Get) El Perro Del Mar God Knows - You Gotta Give To Get: El Perro Del Mar
Dethroning the Optimyth Lansing-Dreiden Dethroning The Optimyth: Lansing-Dreiden
Turquoise Boy Sonic Youth Turquoise Boy: Sonic Youth
Tropiikin Kuuma Huuma Shogun Kunitoki Tropiikin kuuma huuma: Shogun Kunitoki
Now Nomeansno Now: Nomeansno
U.B.L.U.D. Pop Will Eat Itself U.B.L.U.D.: Pop Will Eat Itself
Pissing Carla Bozulich Pissing: Carla Bozulich
Udu Wudu Magma Udu Wudu: Magma
We Share Our Mother's Health (Trentemoller Remix) The Knife We Share Our Mother's Health - Trentemoeller Remix: The Knife
Venetian Red Takagi Masakatsu Venetian Red: Takagi Masakatsu
Retirement Community Kaada Retirement Community: Kaada
Dahlem To Rococo Rot Dahlem: To Rococo Rot
With Charles Bukowski On The Ride Slepcy With Charles Bukowski On The Ride: Slepcy
The Operator (Single Edit) Barbara Morgenstern The Operator - Single Edit: Barbara Morgenstern
Give Me Your Eyes Cardigans Give Me Your Eyes: The Cardigans
Spanish Dance Troupe Gorky's Zygotic Mynci Spanish Dance Troupe: Gorky's Zygotic Mynci
Chewing Gum Annie Chewing Gum - Vocal mix: Annie
Lloyd, I'm Ready To Be Heartbroken Camera Obscura Lloyd, I'm Ready To Be Heartbroken: Camera Obscura
Im Kreis Das Bierbeben Im Kreis: Das Bierbeben
 
fun with macbook keyboard LEDs
2 years ago

MacBooks have a bunch of sensors and lights that can be manipulated with OSX system calls. This blog post shows how it's done.

But the code is cumbersome and C is a hassle, so it would be nice to have this in a friendlier abstraction. So I hacked together a C extension to Python which is importable as a module, allowing you to easily turn the LED on/off with a function call like this:

import led
led.setlight(1) #now it's on
led.setlight(0) #now it's off

Now we can do some interesting things like make it blink and control the timing:

import led
import time
def blink(numblinks, ontime, offtime):
    for i in xrange(numblinks):
        led.setlight(1)
        time.sleep(ontime)
        led.setlight(0)
        time.sleep(offtime)

blink(3, .15, .15) # blink quickly three times

It might be cool to make this into some kind of utility to notify of unread incoming email/tweets/whatever. I'll get to that later.

The code is here: https://github.com/mpobrien/capslight