Tim Hatch

Weblog | Photos | Projects | Panoramas | About

Go ahead, browse the archives.

Eagle freeware upgrade 26 Jan, 2010

If you upgrade your version of Eagle freeware on OS X, and it continually asks for a license key, the file you need to remove is /Applications/EAGLE/bin/EAGLE.key. Other prefs (say, if windows get saved offscreen) are stored in ~/Library/Preferences/EAGLE.plist.

Grepping for Processes 21 Oct, 2009

I learned something new today. Instead of doing

ps auxw | grep procname | grep -v grep

you can just do

ps auxw | grep [p]rocname

since the grep process itself will show up with punctuation in ps.

— via github.

rrdtool graphing script 20 Oct, 2009

If you’d like a copy of a pretty straightforward rrdtool frontend script, I’ve put online the one that I use at home and work for your enjoyment. It's called rrdgraphs.

Open Source and Crashing 20 Oct, 2009

At $JOB we use a lot of open source technology. Our servers run Linux, our dev machines (generally) run Linux, our core products are written with Ruby on Rails and a lot of Python (some Django, not much).

Consequently we do a lot of editing text, and that editing happens without an IDE because that’s easier to do remotely (or maybe we’re just stuck in our ways). For the Ruby guys, that means Textmate and a little bit of classic vi; for the Python folks gVim/CarbonEmacs (all on OS X). Strangely enough, most of the worst crashes all seem tied to editors (but maybe that’s just because we have them open all the time, just like how 90% of accidents occur within a mile of home). I’m about to downgrade from Snow Leopard because of other minor glitches with Spotlight but Berto’s been hitting kernel panics only when CarbonEmacs is open.

Berto taking a picture of a kernel panic

Funny, huh? Not for the second time in a day. And it turns out that Apple Engineering is investigating both of our issues, but nothing yet. At least they’re not duplicates of “existing issues.”

A Simpler Loopback Cable 20 Oct, 2009

Earlier today I posted some info on a double-loopback cable I made earlier this year. If you relax the requirement that the ends be different vendors, it's possible to make a much simpler one.

This cable has the TX/RX cris-crossed, and the grounds connected. That's technically all that's required for something like this, all without custom circuitry. Note that on this picture, black is at the top of both cables.

How to Make a Serial Loopback Cable 20 Oct, 2009

A regular loopback serial cable just ties the Tx and Rx lines, so any characters you send are echoed back on the receive side. For a special project, I needed one that tied together two whole bidirectional ports so I could connect a piece of software that wanted to use a serial port with another that emulated responses for testing. Here's the frankencable I came up with a couple of weeks ago.

Requirements

  • Be built with only parts on hand (that is, in my toolbox at the office, or things I regularly keep in my car, which has more of the same)
  • Consist of two different USB-Serial chip vendors, for easy differentiation with udev rules
  • Work out-of-the-box on most 2.6 Linux kernels (so the Keyspan 4-port adapter is automatically out, with the Ubuntu 8.x bug 149649)
  • End goal: write data into one usb-serial device and be able to read it out of the other, on the same machine.

This ended up being a pretty quick rummage. The only devices handy were two FTDI TTL232 which are TTL-level, and a bunch of Prolific PL2303-based RS232-level chips. The handy MAX232 does this conversion, but I didn#8217;t have time to prototype a board...

But the RepRap to the rescue. I had one of the old comms boards which had a MAX232 on it, but it would need a computer PSU to provide power, except...

It needs 5v which the FTDI cable can already provide.

A few jumpers, a spare servo cable, and some trial and error (I always forget whose perspective Tx and Rx are from) later, we have this wonderful gadget (where every connection is pretty much wired backwards from intended):

Migrating Gitosis from Debian to Ubuntu 20 Oct, 2009

Today I decided it was time to move off Debian Etch and onto Ubuntu, mainly due to needing recent python2.6 and git binaries, and being tired of compiling my own.

The transition was pretty smooth. I started it over lunch and finished (enough to get server monitoring and gitosis back up) in a few minutes after work. In the process I discovered a weird way that gitosis can start silently failing if you move things around:

First, there’s a $HOME/.gitosis.conf symlink that won’t get updated if the post-commit hook is broken. In my case, the hook was:

  1. a broken symlink
  2. once fixed to the new location (for a hint, try python -c "import gitosis; print gitosis.__file__"), the target was not executable
  3. referenced git-update-server-info, and I don’t have the binaries strewn around like that, so had to remove the first dash

Once those were fixed, the contents of $HOME/.gitosis.conf updated as they should, and everything’s happy.

As another useful footnote, you can continue lines in a gitosis config, with leading whitespace like so:

writable = foo bar
      xyz abc

Playing mp3 streams with mpd 24 Sep, 2009

If you’ve wanted to play an mp3 (or aac) stream in MPD, it’s actually a lot easier than you’d think. Just add the url in mpc.

mpc add 'http://sc4.lax.llnw.net:80/stream/kcrw_128aac_live'

If you want to add a station from iTunes, you need to add the station to a playlist, get info on the station, then edit url. Then it is finally copyable.

Reference: Hack:playstream on the mpd wiki

Pygmentizing a directory at once 30 May, 2009

Zed Shaw posted recently about how things are confusing in Python. Just a couple of notes, for the benefit of people in such situations:

The opposite of list.append(x) is more likely list.pop([position]) which removes and returns the item.

If you want to syntax highlight a directory of files, Pygments can most certainly do that:

pygmentize -f html -S trac > trac.css
for f in *.py; do
    pygmentize -f html -O full -O cssfile=trac.css -o "${f/%\.py/.html}" "$f"
done

The fancy substitution on the argument for -o is bash-specific, so adjust for your shell.

Switching to ldap auth 28 May, 2009

The music server at the office got switched to LDAP authentication today with Berto's help... and we came up with this gem to sync user ids after removing local accounts:

cd  /home; for f in *; do echo $f; sudo chown -R $f:$f $f; done

Just make sure you don't have slowish USB devices mounted under your home dir. It went off into the woods for a while.