Monday, April 07, 2008

Geek post

I'm having a problem at work. Students using a ADSL2+ with TPG (an ISP) are experiencing slow connections when downloading recordings (pod casts) of their lectures. Some students have submitted problem tickets to the database we maintain to help diagnose exactly this type of problem.

I need to provide TPG with details of the students who have this problem to help them sort out what is going wrong within their network. When the students submit their problem we record their IP address. Anyway, here is a useful little unix bash shell script I wrote which will read through a list of ip addresses and then do a whois lookup on each one and will print out all the ones from a particular provider.



#!/bin/bash
# script that iterates through a list of ip's in a file provided through stdin
# does a whois look up on each of them and then prints out all the ones with
# a particular ISP - in this case TPG
#
#

FILE="" # variable to hold the file name
if [ "$1" == "" ]; then # if there is no file as an arg
FILE="/dev/stdin" # then get it from stdin
else
FILE="$1"
if [ ! -f $FILE ]; then
echo "$FILE : does not exists"
exit 1
elif [ ! -r $FILE ]; then
echo "$FILE: can not be read"
exit 2
fi
fi



cat $FILE | while read LINE # pass the file line by line
do
ISP=`whois $LINE | grep netname | awk '{print $2}'`
if [ "$ISP" == "TPG-AU" ]; then
echo "$LINE"
sleep 2
fi
done


I always find examples like this found on other peoples blogs useful when searching the web for snipits of tested code.

Wednesday, March 19, 2008

Slug love

P3150127
On the neighbours wall

Tuesday, March 18, 2008

Ol skool

I went to Warrawee Public School way back in the 70s' About a year ago I was driving past on some errand or another and pulled over, jumped the fence and sat on some of the old seats that I used to sit on at lunch when I was 6 or so.

I have few really clear memories from childhood, one of them is sitting on those seats, paper bag containing a carrot, Vegemite sandwich, a block of cheese and a packet of chips in hand wondering what I would look like 'when I was a man'. I remember what I was wearing, what the bark chips and dirt underfoot smelt like, the feel of the waxed paper wrapping. I remember who was next to me, and what other kids were doing, I remember how I felt. I remember staring at my knees and trying to make a photo in my brain that I would be able to see when I was a man. To know me now.

So I sat there on what looked to be the same wooden seats thinking about the life that stretches back. Back to that same seat, a third of a century ago. Of just how unimaginable life is to a kid and I want to ruffle the young me's head and tell him that it's pretty good. Don't worry so much, Oh, and you probably shouldn't put all the lizards and cicadas in Mrs Woolstencroft's draw because you will get the cain.

Friday, February 29, 2008

Leap into Autumn

Those Kiwis, can they have no pride??

Friday, February 22, 2008

Busy much

the students arrive on monday stop IT problem prevents them being enrolled on their on-line courses stop wife has conference stuff on and is in and out of the state at all odd hours stop To busy to post stop