Monday, May 16, 2011

No place like 127.0.0.1

Work is keeping me very busy, but things are ok. Just about debt-free and happy.

Keeping a grip on home with this two-liner:

#!/bin/sh
export home="`nslookup username.dyndns.org | grep Address | tail  -n 1 | awk '{print $2}'`";
sed -i "s/^.*\shome/$home\t\thome/" /etc/hosts;

There's many different ways to accomplish this, and yes, I could use the full domain, but there's something nice about having 'home' in your hosts. You could also easily replace that first line with `cat ~/dropbox/homeip.txt` or `last -i | grep -v ':0\|0\.' | awk '{print $3}' | sed '/^$/d' | tail -n 1` or any other manner of magic to obtain your likely home IP.