Pipe Madness:
#!/usr/local/bin/bashzcat $1 | cut -f11 -d" " | grep -v marginalia | grep -v search | sort | uniq -c | sort -br +1n | more
For those unfamilar with shell scripting and pipes: | basically takes the output from one command and passes it to the other. So this script pares down a referer log with lines like:
67.217.145.34 - - [02/Sep/2003:00:17:05 -0400] "GET /log/archives/i_accidentally_typed_wwwsmokingguncom_into.html HTTP/1.1" 200 5594 "http://search.yahoo.com/search?p=www.smokinggun.com&fr=ieas-dns&vm=i&n=20&fl=0&x=wrt" "Mozilla/4.0 (compatible; MSIE 5.01; MSNIA; Windows 98; YComp 5.0.2.5)"
to a list of (mostly) non-search outside referers, ordered by number of referals.
It’s things like this that make me love the command line.
Update: and here’s something that makes me hate the command line - the above was actually incorrect; there was an extra more | that snuck in there. Fixed.
Idiot 1: Your Favorite Language is bad at doing arbitrarily chosen task X, which it was never designed to do. This just happens to be a field in which My Favorite Language excels.
Idiot 2: Ah yes, but YFL is bad at doing Y, which MFL is great at.
I1: Plus YFL is slow. MFL is fast.
I2: But MFL is faster to develop in than YFL. Besides, Moore’s Law. Mooooooore’s Laaaaaaw.
I1: I’ve never really used YFL, but I’ve read it’s much worse to support.
I2: A programmer can write unmaintainable code in any language. Let’s compare a carefully prepared code snippet from MFL with a horrifically bad snippet from YFL written by a drunken monkey.
I1: Yeah, but strong typing, which MFL supports, prevents many common programming errors.
I2: Strong typing, which MFL doesn’t support, is for weak minds!
(If YFL == Perl)
I1: YFL is ugly!
I2: You just aren’t used to it! Shut up!
Something I stumbled across today, useful for large tables with lots of data. Pointless in some respects, as it doesn't appear to work in IE:
tr.test:hover{ background-color:lightgrey }
td.test:hover{ background-color:white }
| one | two | three |
| one | two | three |
crontab entry for running something on reboot. I actually need this!
Welcome to the latest member of the marginalia.org weblog family.
I decided I needed a place to geek-out where I wouldn’t worry about a certain portion of my readership (hello siblings!) completely falling asleep.