Monday, December 26, 2011

Hosting, DNS, and Domain Name Regstration

I'm moving from my n00b setup of using my domain name registrar's DNS servers to a third party. This way, my registrar, authoritative DNS servers, and web hosting will all be run by separate companies. This makes it less troublesome to change any one of them. (Separating web host and registrar is probably the most important, as your web host is most exposed to your actions, and therefore probably most likely to cut you off. But as long as they don't control your DNS or your domain name, you can swap them out in a matter of hours.)

I'm completely ignorant of the general situation among DNS hosts, but it seems like a pretty straightforward business. Unlike registrars and web hosts, there don't seem to be that many large players here. (Perhaps because the space between people who use their registrar, and people who run their own DNS servers isn't that big? I desperately don't want to be in the business of babysitting BIND, though, so I want someone else to run this stuff or me.) The general pricing scheme seems to be price-per-zone + price-per-X-queries. Seems completely reasonable.

Setup I'm looking at right now:
Registrar: name.com
DNS: Amazon Route 53
Hosting: Google Apps
HTTP redirection: Google Apps (for naked domain/zone apex to subdomain)

I don't have a replacement for my previous host's more-flexible redirection.

Of course, I don't actually *need* any of this bureaucratic fault-tolerance, but it's a nice exercise in paranoia.

For more options, I found this comparison page here, which is mostly useful as an enumeration of options to evaluate. There's also an anemic thread on /r/sysadmin.

Thursday, December 1, 2011

Things I Have Learned to Understand After Moving to the East Coast

Context: I moved from San Diego (where there is no cold) to New York (where there is; [shut up, Midwest]) two years ago.
  • Hot drinks. When it's cold outside, drinking anything hot is very satisfying.
  • Hot showers. When it was cold yesterday and you think it will be cold today, hot showers are a great relief.
  • Scarves. Not just for the French anymore.
  • Gloves. When I was in San Diego, I always silently judged people who wore gloves. After being out in the snow during a Massachusetts winter and discovering my own gloves were inadequate and I in fact needed stronger gloves, I've changed my mind.
  • Long underwear. Only in extreme circumstances. They make regular pants into super pants.

Wednesday, November 23, 2011

Software RAID in Linux with mdadm

I run a RAID 1 (mirroring) with 2 disks. Cheap and simple. (And I don't have to fuck around with RAID card support under Linux.)

I just had 1 disk fail, so I'm about to replace it:
Hold on to your asses everyone. Reminder to self: pull the right disk.

[Edit: Success!]

Monday, October 31, 2011

Google Reader -> Del.icio.us

I guess del.icio.us isn't called del.icio.us since Yahoo! bought it, but whatevs.

Google Reader, which has been slowly dying for several years now, just got dismantled a little bit, when its "Share" feature went away in favor of Google+.

The good news is that it's extremely easy to export your shared items. There's the nice export page here: http://www.google.com/reader/settings?display=import.

There is also an Atom feed available from http://www.google.com/reader/shared/: click "Atom feed" on the right, then change "reading-list" at the end of the URL (it'll be preceded by a "%2F") to "broadcast?n=10000" (or substitute any suitably large number for n).

Someone wrote a procedure and (naturally) a Perl script for converting your Google Reader shared items to a bookmark file that things like del.icio.us can read.

Cheers.

Saturday, May 28, 2011

Hide All YouTube Comments with Greasemonkey Script

The Greasemonkey script "No YouNoobs" claims to remove all YouTube comments -- unfortunately, the versions I've found were out of date, so I updated it: http://pastebin.com/eru2LVqp

Save it as anything.user.js (".user.js" is important), and open it in Firefox -- Gresemonkey will offer to install it.

You need the Greasemonkey extensions for Firefox installed (perhaps obviously). I haven't looked into it for Chrome.

Wednesday, March 23, 2011

Installing Firefox 4 and Making it Usable

I installed Firefox 4 today. It's not in Ubuntu's repository yet, but you can get it from a mozilla repository:


$ sudo add-apt-repository ppa:mozillateam/firefox-stable
$ sudo apt-get update
$ sudo apt-get install firefox


Hurray!

browser.tabs.tabMinWidth has been removed in favor of making people write a userChrome.css file. Create userChrome.css in ~/.mozilla/firefox/{profilename}/chrome. ({profilename} is a random string followed by a dot and the visible profile name. If you have multiple profiles, make sure you're inside the right one.) There should already be a userChrome-example.css file in there. Your userChrome.css file should look like this:


@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

.tabbrowser-tab:not([pinned]) {
  min-width: 40px !important;
  max-width: 250px !important;
}


(If the @namespace part gets wrapped, make sure it's a single line.)

Set min-width and max-width to whatever you want. The defaults are 140px and 250px, respectively. Just adding that breaks tab resizing when closing windows, though, unless you disable animation. Open the magic about:config URL, find browser.tabs.animate, and set it to false.

Restart firefox for changes to take effect.

Tuesday, March 8, 2011

Ripping CDs (from the command-line)

I don't use Gnome or KDE, so I didn't bother with any of those fancy GUI multimedia apps. It's just as easy from the command-line with abcde (A Better CD Encoder):
$ sudo aptitude install abcde id3v2 lame
[insert CD]
$ abcde -o mp3
[wait, watch cute ASCII progress bars]
It doesn't format the filenames in the particular way I like, but that's configurable with a shell function you can define in ~/abcde.conf. Since this was a one-off, I just used mved to clean things up manually.

[Edit, 2011-09-03: My abcde.conf specifies a mungeheader() that works pretty well for me.]

Monday, February 21, 2011

Marry Fuck Kill

I've been spending some weekends working on a little web game with my apartment-mate, Hunter Freyer. The game is entitled Marry Fuck Kill. It's an online version of the parlor game where you must choose to marry, fuck, and kill each of three objects. The objects can be people, or other more abstract things.

The web game lets you vote on items others have made, and make your own. It even has rounded corners!

It's at the point where we're comfortable showing it off, and we think it's pretty fun, so check it out: http://www.marryfuckkill.com

Saturday, January 29, 2011

USB Bit Whacker, Pt 2

(Sequel to part 1. I'm a software person recounting my experiences with a USB Bit Whacker, primarily as a way of keeping semi-organized notes.)

Using the default firmware, it's very simple to set digital output pins and control them. Connect to the serial device with screen /dev/ttyACM0.

There are a series of numbered pins, A0-A7, and B0-B7, one on each side of the chip. There are VCC and GND pins on each side as well. Pick a pin -- for example, A0.

Set pin the pin to be an output pin with: pd,a,0,0 (PD = pin direction, a,0 = pin A0, 0 = output).

Set the pin voltage with po,a,0,0 (low) and po,a,0,1 (high). You can verify the two values with a multimeter. (When A0 is high, compare A0->GND to VCC->GND. They should both be the 5V.)

You can now hook up an LED and a (e.g.) 1k resistor and control it! (Remember not to hook up an LED by itself -- its resistance is very low and you'll blow it up.) Whack them bits.

You can easily interact with the device from the computer by writing to /dev/ttyACM0.  (I can't write to the device with echo(1) on my system, but simply opening a filehandle, e.g., with python, works just fine.)

I've written a few tiny python programs to control the device from the host. They're on github here.

Next steps: Investigate how hard it is to load user-written firmware onto the device from a Linux box.

Tuesday, January 25, 2011

USB Bit Whacker (PIC18F2553)

I just ordered a USB Bit Whacker (UBW; with a PIC18F2553), from SparkFun. This is a brain-dump of my experiences with it. Notably, unlike most of the instructions I've seen online, I'm using a Linux machine to interact with it (Ubuntu 10.10). This is written from the perspective of someone who's fairly familiar with Linux but a complete hardware neophyte (i.e., me).

Plug it in. (It takes a mini-USB connector. Older digital cameras used those.) dmesg should show you something like:

[22377.800069] usb 2-1: new full speed USB device using uhci_hcd and address 3
[22378.040665] cdc_acm 2-1:1.0: This device cannot do calls on its own. It is not a modem.
[22378.040715] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[22378.043499] usbcore: registered new interface driver cdc_acm
[22378.043502] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
"ttyACM0" is the name of the device -- it should appear in /dev/ttyACM0. After a short delay, the amber LED (S1) should start blinking. That means the firmware is loaded.

The ever-helpful GNU screen lets you interact with the UBW through the serial device. I'm connecting to it by ignoring my current .screenrc: screen -c / /dev/ttyACM0

Screen doesn't echo the characters you type, so interacting with the default firmware is a little annoying. Type "v" (and hit return), and you should see the firmware version:
UBW FW D Version 1.4.3
 The SparkFun site has links to docs. In particular, there's a listing of the pins on the device, and list of commands accepted by the default firmware (which is what you're interacting with over the serial connection).

The "o" (digital output) command is of particular interest. It sets 3 digital ports at once, as "o,$p1,$p2,$p3" (where $p1, $p2, $p3 are values in [0..255]). The third one is the unlit red LED (S2). Turn it on like so:
o,0,0,255
The red LED should turn on. Turn it off with:
o,0,0,0
Yay!

Next steps:

The HEX file for the default firmware is available online. So is the source. sdcc has experimental support for PIC18. I haven't tried compiling it. fsusb exists to flash the device. Haven't tried that yet either. It's 2AM so I'm stopping now.

You can easily control the pins from a computer without loading on any new firmware, though -- see part 2.