Hello, goodbye

You liked F1 racing and made me look kind of reactionary. You hated Zen and people misusing or misspelling Latin phrases. It was fun to tease you by writing koan-style poetry ending in “per say.”

It was good knowing you, Andy.

Double click for new terminal

I’m completely dumb at the Apple-way-of-scripting. I wanted something I could throw on my desktop that I could double click and it would open a terminal window and ssh somewhere. I’m not sure how useful this will actually *be* to me, but given it took me non-zero time with google to figure it out… thanks to various stackoverflow posts.

Open Applescript Editor. Put in:

tell application Terminal
do script "ssh hostname"
set bounds of front window to {63, 640, 1212, 1022}
end tell

File | Export … and save it as an application. Put it on your desktop, giving it a reasonable name. Done. If you want to later edit the script (say, to set boundaries :) ), right click, Show Package Contents, then go into Contents\Resources\Scripts and edit the main.scpt file you’ll find. The “set bounds” statement places the window at the bottom-left-ish and makes it 160×25 at my current resolution and font size. I can’t figure out how to tell Terminal to just set itself to 160×25 without also moving it, and I expect that the actual characters displayed depends on font, size, etc.

Making Mail.app usable

Thunderbird finally drove me over the edge. Might have been that whole “no new features OH HEY YOU CAN IRC FROM YOUR MUA” – guys, if I wanted emacs, I’d use it.

I used to care a lot about Enigmail. For various reasons, I care less about it now. There are, however, a few things that I would miss about it. Oddly, the one that I kind of missed the most is the most whimsical – I like having my default signatures rotate. So I did a bit of digging, and came up with some applescript (courtesy clapper.org‘s post on the subject) only slightly modified.

Also, being a complete Mac-centric scripting n00b, I wasn’t sure how to make things go. Save the Applescript into a file called… anything. Run osacompile against it. You can call the resulting compiled script from your .bashrc with osascript, something like

osascript /Users/foo/bin/sigrot.scpt

Another relatively minor irritation is the default behaviour of never marking mail as read, or marking it as read instantly. You can theoretically fix that with

defaults write com.apple.Mail MarkAsReadDelay 4

but that didn’t work for me (10.8.1). Instead, I used TruePreview.

Now, if only I could convince it to show me messages most recent at the top, but when they’re threaded, show them most recent at the bottom.

Documentation and maturity

There are three stages of maturity when it comes to getting things work and documenting how you did it.

1) I got it working, hurray! Run away before it breaks.

2) I got it working, hurray! And I took notes while I was getting it working, so I’m good. Run away before it breaks

3) I got it working, hurray! And I took notes while I was getting it working, so I’d better start from scratch and make sure my notes work.

chkconfig, mysql

A crash today brought home a couple of things that I should have known before but didn’t, and now I do. I’m writing them here so I don’t forget, but also because google results were annoyingly useless without digging.

#1: chkconfig. That funny line in the init script that says something like “# chkconfig: 23456 88 22”. It’s easy to find out that the first batch of numbers is runlevels, but less easy to find out the meaning of the second set. They’re priorities; the higher the first number, the later in the boot process it starts. The higher the second number, the later in the shutdown process it’s killed. Also, if you change those numbers – this is obvious in retrospect, but I forgot – you need to re-run “chkconfig on servicename”.

This is apparently all defined in the LSB. Back in my day, there was no that thur LSB, never mind chkconfig. You just put scripts in /etc/rc.d and crossed your fingers.

#2: misamchk. This worked fairly well on my 72GB RAM server with a ~25GB database:

myisamchk --fast --update-state --force --sort_buffer_size=1G \
--key_buffer_size=2G --read_buffer_size=512M --write_buffer_size=512M \

The myisamchk manpage talks about “a lot of memory” being 512M so obviously it could use a bit of modernizing. That, or it really is MyFirstDatabase.

And this kind of stuff reminds me that while I need to keep my hand in, I’m just as happy to no longer be a sysadmin for a primary job duty.

(Edited Aug 2012 – neither should typing be, chkconfig on, not chkconfig start.)