Bash keybindings

Posted at 2007-01-20 13.05

Some wonderful person (I can't believe it was me) made me a .initrc file for my work home directory. It contained one line:

set mark-directories off

I wouldn't press you to go out and copy me, for its effect is to stop tab-completion from putting the trailing / onto a completed directory name, so you have to do cd //….

One of my colleagues found this config item and thus fixed this terrible problem I'd been having.

However, this led me to reading more about bash and its interaction with readline. It turns out that you can bind commands to a bash key combination. This has the effect of running the command at that point, regardless of whether or not you're in the middle of editing another command.

I bound M-'-' to pushd ..' and M-'=' to 'popd'. This lets you zoom up the filesystem tree, then zoom back in once you're finished with it. Very handy:

bind -x '"\M--": pushd ..'
bind -x '"\M-=": popd'

I'd be interested to hear what bindings you come up with.

— ads
Filed under: Computing
Shuttle power

Posted at 2007-01-20 12.14

I've taken to using the overflow car park at work, which is so large it can be seen from space!. It also happens to be a whole two minute walk from the office. "What has this to do with the price of Peruvian cheese?!", I hear you cry. Well, as it happens, we have a shuttle bus to save our poor legs.

A colleague has experimented with this service and tried to out-run it. He is yet to beat the shuttle’s latency on foot. So maybe it makes economic sense to run it. Personally, I'd rather just walk but the bus driver looks so lonely…

— ads
Filed under: Misc
The sullen schemer

Posted at 2007-01-20 10.47

I occasionally like to pretend that I write in Scheme. It’s a language I very much admire. However, I tried the other day to write a reduce function in Scheme and was surprised and annoyed that certain language features were missing. I really miss pattern matching and partial application whenever I write Scheme. Maybe I should move to Haskell and be done with it — but then I'd have to start trying to understand monads.

— ads
Filed under: Computing
Mountain View

Posted at 2007-01-19 08.01

This posting is mostly a retrospective on my time in Mountain View and how it compares with the UK.

Firstly, America is a great shock to the old-world me. The stunning regularity of the grid system, even in small "cities" such as Mountain View. Not that Mountain View is actually a real city. It has virtually no town centre (ahem, center) — though it’s way better than Cupertino in this respect. It has one road of 'downtown' comprising of a fair number of restaurants, a mortuary and remarkably little else.

The roads here are also awesome in girth. Virtually every road is a four-lane highway, making walking around somewhat difficult. Still, to compensate for this, there are traffic lights every few yards (not that Americans believe in the yard, preferring to measure in tens of feet). We were thrown out of the bar last night at around 10pm, not for rowdiness but because they were closing!

The people here are very warm, as is the weather. I encountered remarkably little ignorance among my colleagues (sorry, coworkers) and church friends. I was pleasantly surprised that most people accepted my English sense of humour (humor) and some even understood it.

I did, however, find that the media in the US are very insular: they seem barely to know of a world beyond the US and what it’s currently invading.

Some of the words that I use quite freely in the UK have a very different meaning over here in America. I am used to describing myself as an evangelical Christian. It turns out that over here, the word has been hijacked by the lunatic right-wing 'Christians' who want to legislate against anything that’s not strictly doctrinally valid, according to their limited imagination. So I have to explain that I'm evangelical in that I'm willing to live my life openly as a Christian; just not one who wants to enforce my opinions on others.

Then, there are the things about this country that are just utterly messed up. The most significant of these has to be the healthcare system. If you have no health insurance, I heard on the radio today, you're a "public health hazard". There are ads everywhere to persuade people that they must nag their doctor to prescribe PharmaCorp’s very own brand of pill.

Furthermore, many here seem concurrently contemptuous of European legislation to limit the hours of the working week and complaining that they're over-worked.

Things I like about America: the utterly un-self-conscious patriotism, the general optimism and feeling that Things Can Be Improved, the weather and the mountains that this place is named after.

I'll miss the friends I've made here but I'll be very glad to return to Dublin — for none of the reasons I've described above. My department, Site Reliability Engineering (SRE), is scattered throughout the campus over here, whereas in Dublin we're all on the same floor and have a shared and very tangible camaraderie.

— ads
Filed under: Me
Catch 22 on 80,000% discount

Posted at 2006-10-17 00.34

I'm off to sunny California at the end of the week, as part of what my boss calls my "Google Indoctr^WTraining". This caused a book crisis, because all the books I had out of the library needed to be returned and I was in the middle of one of them.

So I went into WH Smith and pick out a copy of Catch 22 by Joseph Heller. Splendid book, by the way. Although it was priced at £8 on the back, the book was scanned in at a cost of 1p. Yes, a whole penny. The girl at the counter thought this might be wrong so she sent me upstairs (escalating the problem, eh?) but the same happened. The twelve-year-old at the till there also considered this to be in error, so he went away to seek higher authority (I think he went even further upstairs). When he came back he scanned it again, it came up at 1p again and without even commenting on the anomaly, said, "That'll be one penny please."

Makes the three books I got from The Works for £5 look positively criminal in comparison.

— ads
Filed under: Misc
The frustrated hypnotist

Posted at 2006-09-17 01.35

I was out with friends (including Jennifer) at another friend’s party at her house. Towards the end of the evening, she reminded me that she'd been asking me for ages to hypnotise her — and this was the first chance we'd had.

I sat her down, made sure she was comfortable and relaxed, then proceeded with the hypnosis. Everything was going well, especially considering that there were six of us in the room (at most three too many to be ideal). Feeling quietly confident, I was certain that nothing could stop me from a successful hypnosis. Her fingers and toes had started to lose their sense of touch, which is the first stage that I take my subjects through on the way to a full state of hypnosis.

Then a helium balloon that had been minding its own business suddenly hurled itself across her field of view, breaking her concentration and making her giggle uncontrollably.

We agreed to leave it for another day. Sometimes it’s just not meant to work.

— ads
Filed under: Misc
Asperger Syndrome

Posted at 2006-09-15 08.35

The elder of my two sons, D, (he’s 6) was diagnosed last Friday with Asperger Syndrome. We've explained to him that although everybody is different, other people who are similar to him are said to have Asperger Syndrome. After a few false starts (he thought he was going to have to learn a new language for it), he got the idea.

It’s such a shame that so many resources lump Asperger with disabilities. I firmly believe that D is not disabled; he’s just different — and in some ways, better than his peers. The diagnosis put his speech and language proficiency at the level of a child twice his age. He’s highly literate and numerate, scientifically adept and has a wide range of knowledge from the UK party political system to stars and galaxies.

I suppose I'm feeling defensive but, of course, it was we who decided we wanted a diagnosis. I think it'll help provided we're very clear to him that he’s not disabled.

— ads
Filed under: Family
DNS and BIND, 5th Edition

Posted at 2006-09-14 12.35

I put this review in the hreview microformat, so with any luck its structure should be easily parsed by machine.

  • Authors: Cricket Liu and Paul Albitz
  • Type: book
  • ISBN: 0-596-10057-4
  • URL: http://www.oreilly.com/catalog/dns5/
  • Publisher: O'Reilly Media
  • Price: £35.50
  • Published: 2006-05
  • Pages: 650


Excellent book, essential for the BIND administrator.

This is a truly remarkable book. It has been revised and improved over
its 14-year history, resulting in a vast and authoritative yet readable
account of DNS and especially BIND.

The good

The authors have chosen to remove most references to BIND 4 from this
latest edition, concentrating instead on various versions of BIND 8 and 9.

The book covers all aspects of DNS and how to implement them in BIND,
including DNS zones and subdomains, Dynamic DNS, zone transfers, mail records,
DNSSEC and IPv6.

It has a large chapter on DNS security, describing DNSSEC, TSIG,
split-horizon and prescribing various models for securing BIND.

I was very impressed with the chapter about DNS programming: an aspect
of Unix that is imperfectly documented in the manual pages at best. Liu and
Albitz’s treatment of this topic is, as with the rest of the book, clear and
exhaustive.

However, the twin highlights of the book were the chapters on
maintaining and debugging BIND. The maintenance chapter sets out the seasoned
expert’s approach to looking after BIND, and the chapter about debugging
describes the 13 most likely causes of BIND problems, from the authors'
extensive knowledge of taming the beast.

The bad

I was uncomfortable with the book’s overuse of the deprecated
nslookup program for debugging. It does justify this by saying
that it’s widely available, but in my opinion this is a poor reason for using
a substandard tool when better alternatives, such as host and
dig are almost as widespread.

Also, I was disappointed that BIND was the only DNS server
considered for Unix. Surely a chapter or two on djbdns would not have gone
amiss.

The ugly

Read this book if you want to know in intimate detail just how buggy
various versions of BIND (up to 9.3.2) are. Liu and Albitz document, in loving
detail, the flaws in BIND. If you must use BIND, this book is essential.
However, it has convinced me to avoid BIND in favour of djbdns wherever
possible.

Score: 8/10

Andrew Stribblehill

2006-09-05

— ads
Filed under: Reviews
8.5 days

Posted at 2006-09-12 02.02

I have 8 and a half working days to go before I leave the IT Service!!!1!! Here’s the story so far…

<fx style="whizzy" title="five months ago" />

Google Recruiter Come and work for us! Apply! Apply!
Me No. I like Durham Just Too Much.
Recruiter Aw, g'wan, g'wan, g'wan
Me No.
Time passes
Recruiter Thanks for the conference. Cheerio.
Me Actually, I'd like to apply to work for you after all.
Recruiter Well-masked internal sigh

<fx style="snazzy" title="two months ago" />

Head of Department I know this will come as a shock to you but the role analysis we did says you're overpaid.
Me Thinks: Coo, my plan to resign tomorrow was timely. "Ummm, oh dear."
Head of Department You're taking the news well, I must say.
Me Thinks: Just you wait… "Thank you."

<fx style="swooshy" title="the following day" />

Head of Department I presume this is about the role evaluation…
Me Actually, no. I resign!
Head of Department Gasp!

<fx style="floozy" title="back to the present" />

So here I am, having all but worked out my notice period. It would be a lie to say I'd loved every minute of my time here, but the overwhelming majority of the time has been some combination of fun, challenging, instructive and improving.

Some highlights:

The Cocos Islands Bug

The Cocos Islands form one of Australia’s two Indian Ocean Territories (the other being Christmas Island). But that’s not important right now.

Back in 2001, Solaris hosts running X were taking an age to get from the login page to the desktop. Eventually, it was tracked down to a problem with the font servers. We checked the font servers themselves, and they were fine. Then we noticed the font path that had been set. It went hostname.cc:7001. For some reason, all the Solaris hosts had switched from hostname.dur.ac.uk:7001 to .cc, our NIS domain.

Turns out: VeriSign decided to put a wildcard entry in for *.cc, and since it resolved, Solaris decided to use it.

Molten web server

The web server manager had gone on holiday, yet it was a Strategic Imperative to put the new (spanglly and dynamic) web site into production. It quickly became apparent that the web server wasn't up to the new job. A colleague and I found a minimal-impact solution: we put a caching reverse web proxy in front of the web server. This drastically reduced server load, almost to the original level.

Sadly, when the web server manager returned, he was decidedly unhappy about the new service architecture. However, it was only when we replaced the back-end web (Sun Ultra-60) server with three new Linux hosts, that he felt comfortable to remove it.

Exam marks

I had become the web server manager by this point in the narrative; the web servers were entirely adequate for all but the worst load. However, one Wednesday at the end of term, each server suffered a debilitating load spike, caused by 10% of the students' exam marks being released.

About 60% of them were due to be released the following Wednesday: an act which would have resulted in some impressively grumpy students if we didn't do something about it.

I was able to replicate the web servers onto a chroot inside each of the six extra servers we recruited as a scratch web cluster. (Just tar cf - / | ssh host sh -c 'cd /chroot && tar xpf -) and on the host, run chroot /chroot /etc/init.d/httpd start).

To spread the load between such a disparate set of hosts that we'd pulled together (from quad AMD64 hosts to Sun Ultra-10s) we used Apache 2.2’s load balancer, mod_proxy.

With this and some substantial code improvements on the Web Team’s part, we were able to serve just over 400 page impressions a second to a substantial proportion of the student population. This is around ten times more than the usual rate, and none of the hosts were under significant load this time.


Of course, these are the sort of everyday heroics in the life of a sysadmin that usually go unreported. C'est la vie!

— ads
Filed under: Computing and Me
Once a physicist, always a physicist

Posted at 2006-09-06 15.02

I was walking over the Kingsgate Bridge one morning in October 1995 when my companion and I wondered how high it was. Without another word being spoken, he dropped a coin over the bridge and we timed the descent. Continuing the walk, we did the maths between us and estimated it to be around 70 ft above the water. It was only later that I saw this as the moment in time at which I became a physicist.

Fast forward to yesterday. Making the same journey with a different friend, I wondered aloud what the volume of a McDonalds drinking straw was. We chose a radius of 1/π cm and a length of 5π cm, thus the capacity was 5 ml. He tells me that multiples of π is a physicist’s approach!

My point? Even when you think you've left your degree firmly in the past, it can still rear out of the back of the brain and surprise you.

— ads
Filed under: Me
ok