Make bash show the return code

When using a command line interface, I like to see all the output a program makes. The standard out and error are already dumped to my console, but there is one piece of information usually hidden from the user: the return code.

Add the following to your .bashrc to get a nice notification if a program returns a non-zero code:

export PROMPT_COMMAND='ret=$?; if [ $ret -ne 0 ] ; then echo -e "returned \033[01;31m$ret\033[00;00m"; fi'

It looks like this:

user@host$ false
returned 1
Posted in Uncategorized | 6 Comments

NSA Puzzle

The NSA recently declassified their Cryptolog internal magazine. I would like to share one gem from Cryptolog XIV, No. 1 – 1st Issue 1987:


The occurrence of “NSA” as a letter sequence in English words is rather uncommon. Some of the rare examples are show below. Fill in the blanks to reconstruct the “NSA” words defined.

Crazy _ n s a _ _
“Land of Opportunity” _ _ _ _ n s a _
Lacking sodium chloride _ n s a _ _ _ _
Pay for damages _ _ _ _ _ n s a _ _
Miniature tree _ _ n s a _
Unable to be satisfied _ n s a _ _ _ _ _ _
Across the ocean _ _ _ n s a _ _ _ _ _ _ _
Middle eastern inn _ _ _ _ _ _ n s a _ _
Unhealthful (as a climate) _ n s a _ _ _ _ _ _ _ _
Not spoken _ n s a _ _
Search thoroughly _ _ n s a _ _
Deny or contradict _ _ _ n s a _
Not paid regularly _ n s a _ _ _ _ _ _
Relationship by descent from a common ancestor _ _ n s a _ _ _ _ _ _ _ _
Unclean _ n s a _ _ _ _ _ _
Result of a bank visit _ _ _ n s a _ _ _ _ _
Disagreeable or disgusting _ n s a _ _ _ _
Type of roof _ _ n s a _ _
Sail on a square-rigged vessel _ _ _ n s a _ _
Able to combine with other substances _ n s a _ _ _ _ _ _ _

1st Issue 1987 * CRYPTOLOG * page 29

Posted in Uncategorized | Leave a comment

The Ablogalypse Already Happened

xkcd predicted that “The Ablogalypse” would occur in October 2012, it actually occurred in November. Pretty neat prediction though!


Posted in Uncategorized | Leave a comment

How Domains Became Backwards

Internet URLs, file system paths and IP addresses usually get more specific as you move towards the right hand side. This is a clearly a byproduct of the left-to-right language of the designers of these systems. So why is it that this website is and not net.newgas.david?

The familiar hierarchical naming is part of the “Domain Name System” created in the early 80’s by early internet engineers. They already had a internet naming system with cryptic, non hierarchical names like BBN-TENEXD and MIT-Multics. This was basically maintained in one giant text file managed by one organisation.

Faced with a network growing at ever increasing pace this system was becoming a nightmare to maintain. A naming system that followed administrative hierarchies seemed obvious, and was spelt out in RFC 822.

At this stage the right-to-left notation was already settled so to answer our question we must go further back to RFC 805, with the unhelpful title “Computer Mail Meeting Notes”. Here they discuss exactly how to add the extra hierarchical info.

One of their biggest concerns was email addresses.  These were already of the form user@host and they wanted something that extended this naturally. Here were some options they may have thought of:


It’s fairly easy to see why they picked Cerf@ISI.ARPA – the information consistently gets less specific as you go along. The other options are more jumbled. Quoting the RFC makes me sound foolish for even thinking the addresses are backwards:

… the [email address] would read (left to right) from the most specific to the most general.

So there you have it – domains have the most specific part on the left hand side to make email addresses look good!

Posted in Uncategorized | 25 Comments