May 2008 Archives

Workaround for router lameness

If you are setting up OpenVPN for a network full of macs, and you have a LAME LAME LAME Apple Airport Extreme as your router, you won't be able to add a default route so that packets can go from your various macs, back to the OpenVPN gateway, and then back to the outside clients. So a workaround is to add a route to every Mac in your network. Which is easy for me, since I only have two. But it would suck in an office of, say 20. Anyway, here's what you do. Fill in your own OpenVPN network routes and Gateway IP yourself. sudo route add -net 10.69.0.0/24 10.0.67.10 P.S.: I'm buying one of these because I'm tired of Airport Extreme Lameness. And I'm going to put OpenWRT on it and run OpenVPN right on the router. Maybe. To delete the route: route delete -net 10.69.0.0 10.0.67.10 255.255.255.0

Emacs Notes for Summer 2008

Every now and then, I re-evaluate and switch up the emacs version that I use. Often this is driven by a major OS upgrade, like Panther->Tiger or Tiger->Leopard. Sometimes it's just because it's been a while, or something that has been bugging me, and I've reached the breaking point. Or I want to avoid real work for an hour. In the version of Carbon Emacs I used for Tiger (which I had built myself from GNU sources), I had some emacs lisp that would set the default font on startup. The built in default font was too big for my tastes, and it was consequently anti-aliased. I really don't like anti-aliased fonts in my editors and terminals. For some reason, this lisp no longer worked in the Carbon Emacs I had to start using for Leopard. In fact the little dialog box that you could pop up a standard Mac font selector window didn't even work, so I couldn't change the font from the default Monaco 12-point anti-aliased font. I've been suffering this cruelty for over 6 months. Today I tried a number of recipes for getting a newer emacs (I wanted to try 22.2), but they failed. I ended up using this hack: First, download emacs 22.2 sources from GNU. cd emacs-22.2 sudo cp -R mac/Emacs.app /Applications/Emacs.app sudo cp /usr/bin/emacs /Applications/Emacs.app/Contents/MacOS My old lisp still didn't work the way it used to, but part of it did: (global-set-key "\C-x\C-t" 'mac-font-panel-mode) This allows me to bring up the little Mac font selector window. Then some apropos work turned up "set-default-font." Mac fonts on Emacs have seriously inscrutable names. But if you interactive run M-x set-default-font and then hit ? when it asks which font, you get a nice listing of ALL the crazy Emacs-ized mac font names. The font I wanted was: (set-default-font "-apple-monaco-medium-r-normal--10-90-72-72-m-90-mac-roman") That's Monaco 10 point. So I just stuff that in my emacs lisp initialization file along with: (global-font-lock-mode 1) (set-frame-width (selected-frame) 90) (set-frame-height (selected-frame) 80) (set-frame-position (selected-frame) 1 6) And my Emacs is ready to use when it starts up. Just like back in 1991 on my SPARCstation 2.

uptime

| 2 Comments
$ uptime 08:58:45 up 198 days, 19:37, 1 user, load average: 0.87, 2.05, 2.47 Yeah! (I just jinxed myself)

Normal People Become Mac Nerds

I'm a computer geek, and I mostly hang around other computer geeks. So my views of what is really popular in terms of information technology are very skewed. I'm very aware of this bias, because at work we are trying really hard to make our software easy to use and popular with norms. That's normal people, not computer dorks. A vast portion of the technology arguments we have, I fully realize, are irrelevant to the norms. They don't give shit about Unix, or Macs or Vista. They know that there are computers, and there's the internet (or Google, which is, for a lot of people, the internet). People just want something simple that works, and all the other bullshit that we Valleywag readers care about doesn't even register on their personal radar. That's what I thought as of a few days ago, anyway. I had jury duty the other morning, that great democratic cocktail shaker that stuffs a couple hundred citizens from all the American castes in one room for 4-5 hours. Mostly I just kept my head down and read my sci-fi novel. But I couldn't help overhearing a conversation of three norms sitting nearby. One guy, maybe was in his late 50s, seemed like he owned a small business of some kind. Sounded like a good guy, I think maybe with a Woburn accent, probably not a college type. Definitely a norm. There was a college-age woman or maybe a little older: she seemed like a typical Gen Y-er, but not technical. And there was a kid, maybe 21, a semi-goth maybe. A video game junkie, probably. Also not a tech person. I heard bits and pieces of stuff and then started listening. They were having the Mac vs. PC discussion. It wasn't the religious thing. Nobody in the conversation was saying PCs were better. The older guy and the woman were basically spouting the party line benefits of Apple and Mac, getting some of the ideas a little wrong or garbled, but mostly getting it right. The younger guy was the PC user and he was playing the role of "I have this old PC and I need a new one, but I don't really know about how to use Macs." The other two were right on this, talking him through how it wasn't a big deal, it just takes a little getting used to, and everything works so much better. I was floored. I didn't think it would be possible to dislodge Windows from it's preeminent position on the desktop. No matter how bad Vista sucked, or how great OS X was. Now I'm not so sure.

Great Discoveries in Science

Largest Raisin Bran Raisin Blob of All Time I don't think there's really anything to add.

nmap

nmap is a useful port scanner. I use it to make sure a new server that I set up is locked down.

BitTorrent explained

So, the answers to my BitTorrent questions lie in the BitTornado package. It has completely clear, step by step documentation on how to set up a torrent, tracker and seed(s).

How to set up a private BitTorrent tracker.

| 3 Comments
The software and documentation on the web that I can find on this topic sucks. Big time. The vast majority of people using BitTorrent are pirates. I just want it to blast my own software across a large (more than 100) number of servers quickly. In this document, I'll post what I can figure out. Feel free to chime in if I get any of this wrong. To set up a BitTorrent ecosystem, you need a few things: 1. Some files in a directory. 2. A BitTorrent tracker program. This runs on the server with the "master" copies of the files to distribute and is how updates get propagated to the clients. 3. A bunch of BitTorrent clients. These run on each target machine in the network to download updates from the tracker and from each other. 4. A torrent file, which describes the files the tracker is making available. You put the files in some directory on the master server; then create a torrent file; start the tracker specifying the torrent file. Then you run the clients on all the machine in the network, and point them at the initial tracker and it's torrent file. Then, boom, everything gets sprayed all over the LAN. As I've written before, BitTorrent software is a mess. The original BT software is a sordid mess that depends on layers of Python extensions. The documentation pretty much blows, and is geared toward the pirate user who is basically looking for a way to download the latest music video. I found what looks like a pretty clean tracker implementation. It's old school; a C-language program that depends on one other library, a nice C-language daemon framework. Unfortunately, the documentation for opentracker is virtually non-existent. It seems to assume that you know all about torrents and trackers, which I pretty much don't. So I'll write what I figure out here. Compile opentracker I'm quite encouraged by this, because it actually worked perfectly as advertised. These commands worked perfectly for me on CentOS Linux 5 and Mac OS X 10.5. cvs -d :pserver:[email protected]:/cvs -z9 co libowfat cvs -d:pserver:[email protected]:/home/cvsroot co opentracker cd libowfat/ make make install cd .. cd opentracker/ make Set up files I made a directory called /usr/local/torrents and I put a big file in it. I randomly chose the Firefox Mac distribution, and called it "firefox.dmg." Exciting. Create the torrent. I used "createtorrent" to do this. Createtorrent is a utility you can get from ports or debian packages. It is very easy to build and install. % createtorrent -a http://buffy.ma.runwaynine.com firefox.dmg firefox.torrent computing sha1... done % ls -l total 34520 -rw-r--r--@ 1 root wheel 17669478 May 22 14:18 firefox.dmg -rw-r--r-- 1 root wheel 1506 May 22 14:20 firefox.torrent % opentracker -p 6881 -d /usr/local/torrents (starts running) That was easy. OK, now I'll go over to my bittorrent client and try to get the torrent. This is where I find BT a bit weird, and it probably means I really don't understand what's going on here. I would think the BT client would allow me to connect to the tracker I just started running, and start seeding/downloading the file. But I don't know what URL to connect to on the opentracker. If I open the firefox.torrent file directly with my BT client, it looks like this: But it just sits there, waiting to start downloading. I don't know why it won't start seeding from the tracker. Hmm. I just found a really good document. Finally. See the next post.

note to self: handy tool for diagnosing site downage

How the heck do I set up a BitTorrent tracker?

| 1 Comment
Why is this so friggin hard? At work we have a couple hundred servers, and we like to install software on them a lot. Like every day. The software images are kind of big, maybe 100-200mb each, and there are maybe 20 different "types" of them. We more or less want to copy all the images out to all 200 machines really fast. Instantly would be great, but we'd settle for a minute or two. We have way expensive switches with 32 gigabit aggregate bandwidth, so 32 file copies could be happening simultaneously at fill 1000 megabit wire speed before we'd run into a wall. We've had the idea for a long time to run our own little bittorrent universe on our LAN, with a client on every machine and a tracker that would get the master copy of everything. I've just about pulled all the hair out of my head trying to make this work. BitTorrent.com has sold out to the Music/TV/Movie industry, and their web site is all useless drivel about how to download movies on the Windows BitTorrent client. There are 17 zillion people who have written their own bittorrent trackers, but those sites are loaded with ads about free pr0n, and it doesn't give me a happy feeling about installing into my production data center. Or my own workstation for that matter. I've tried downloading the BT source code from sourceforge; that's apparently gone. Darwin/Macports installs of bittorrent bit the giant FAIL with all kinds of fucked up Python dependencies. It's looking like one of the most popular and probably easiest trackers is a PHP-based one called BT Tracker. But there are 500 flavors of that, and I really don't want to have to set up a web server to set up PHP to set up a tracker for an internal system. Doesn't anybody just make simple, self-contained daemons anymore? Got any hints? Amen, brother. Update: promising. Um, maybe not.

note to self: dropio

drop.io is a very tidy upload site, like dropsend.

Tunnelblick Alternative for OpenVPN on Leopard

I've written before about how great OpenVPN is, and how to set it up. I've always been using Tunnelblick as a nice little GUI to do the client side connection on Mac. But Tunnelblick has some problems on Leopard, and I think the maintainer is quite busy with something else; it's been semi-broken for a while, and the last release was October 2007. The main problem is hanging: sometimes you just can't quit, and even kill -9 doesn't kill the process, it's just totally zombied out. Rebooting works, but the shutdown takes a while as the OS times out on the dead Tunnelblick. I found that Macports has openvpn2 easily available. So I simply: sudo port install openvpn2 Then: cd ~Library/openvpn sudo openvpn2 --config work.conf Actually I made an alias to do the second part so I can just quickly connect without thinking about it. Works like a charm. Update: my pal Kristin pointed me at this page, which is important and helpful, in that it has a pointer to a leopard tun/tap driver. Which you need.

Periodic Steve Yegge pointer

Remember how I said I thought Stevie was my slightly smarter, long lost twin? I was wrong. He is way, way smarter than me.

Can I implode the interwebs?

Notice the first three images here. See how the second image contains the third? and the first contains the second? How far can I go? Level 4 recursion

Note to self: make iMovie work with ReadyNAS

I found this on the new readynas.com commuity site: http://www.readynas.com/?p=291. Looks like there's lots of good stuff there.