Tim Hatch

Weblog | Photos | Projects | Panoramas | About

The new place 22 Jan, 2009

I'm excited to report that I have new living conditions! I've lucked into a room near Mesa in a really quiet place. Although my commute has doubled in time, the time to the beach is down to about 45 seconds down a hill.

This is the sunrise a few days ago from my patio.

Time for a new stylesheet 22 Jan, 2009

Don’t freak out, the styles are just changing. Here is what it used to look like: 2008_styles.png.

Party Shuffle in mpd 12 Jan, 2009

I set up mpd for the office over the weekend, so we can all contribute instead of just having one person driving the musical selection. The one feature we were missing was a good way to add songs randomly... so I whipped up this script (just keep it running in the background):

#!/bin/bash

NUM_SONGS=10
OLD_SONGS=25
OLD_HYSTERESIS=10

# Functions
# 1. "Party Shuffle" adding random songs to the end when the pointer gets too close.
# 2. Removing old songs (say 10 before the pointer)
songs_left() {
    mpc playlist | sed -e '1,/^>/ d' | wc -l
}

playlist_pos() {
    mpc playlist | perl -ne 'print $1 if /^>(\d+)\)/'
}

random_song() {
    mpc listall | sed -n $[RANDOM % $(mpc stats | grep Songs | awk '{print $2}')+1]p
}

oh=$(( $OLD_SONGS + $OLD_HYSTERESIS ))

while [ 1 ]; do
    while [ $(songs_left) -lt $NUM_SONGS ]; do
        mpc add "$(random_song)"
    done
    pp=$(playlist_pos)
    if [ $pp -gt $oh ]; then
        seq 1 $(( $pp - $OLD_SONGS )) | mpc del
    fi
    sleep 20
done

Desk, 2009 08 Jan, 2009

Wow, 2009 already. I’ve been 6 months at Nutricate (warning: Flash), and haven’t yet posted a desk pic.

This is how it looked at the beginning of December, right in the middle of one of our development cycles. My laptop is being held up by two dead receipt printers (not my fault), with two multimeters, three wireless routers, and several half-built modular adapters sitting around.

One of the cables hiding behind the monitor is audio being routed over cat-5, which works surprisingly well. We tried using an Airport Express but the traffic doesn’t play nice with our WRT54G main router (it starts needing to be reset every couple of GiB).