Tim Hatch

Weblog | Photos | Projects | Panoramas | About

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