Monday, August 9, 2010

Ubuntu Server 10.04.1 virtual release party

Ubuntu Server LTS 10.04.1 is targeting to be released this Thursday on the 12th of August. This point release is especially important for the "server" variant of Ubuntu. This is because many conservative sys-admins wait for the first point release before deploying a server OS. The idea being, any bugs the fine QA people at Canonical might have missed, would be caught by the community during the period between the GA and point releases. This means that for many, this next 12th of August is the "actual" release date for Lucid server LTS! In short, on the 12th Ubuntu Server 10.04.1 is ready to rock the world!

In order to celebrate this awesomeness, we'll be having our own little server release party in the clouds :) What a mouthful, well basically I've put up a nice little web application that tracks all cities around the world that are running Ubuntu Server 10.04. Of course you will need to hit that web app with your server box first so that your city becomes registered and shows up on the map! So if you're already running 10.04 server, be sure to hit that application. If you're not, then you should be! Go grab yourself the 10.04 server iso, install it, then hit the app with it

But wait a minute, you say you don't have a web browser on your server box. No problemo. I'll list a few cool ways (well in a serverish way at least) to hit that web app without leaving your comfortable bash shell! Hey community, if you can think of cooler CLI methods, be sure to put them in your comments. if something is very cool, I'll add it to this post. Here we go

1- elinks --dump

2- curl

3- wget

4- python -c 'import urllib; urllib.urlopen("").read()'

5- /bin/echo -e 'GET /hit/ HTTP/1.1\nHost:\n\n' | socat -

Well I guess that should be enough to wet your appetite. Of course "technically" you don't have to visit the web app using your server box. Hitting it from your Ubuntu desktop has the same effect, but where's the fun in that! If you're running Ubuntu Servers in multiple cities, you are encouraged to hit that app from all cities in which you operate. If you coordinate the hit with some cool stuff (maybe a puppet recipe or bounce over ec2 or something of that sort) let me know about it :)

Whichever CLI way you choose to hit the app with, you'd be missing out on seeing lots of cute little Ubuntu logos over a world-wide Google map. Now that is something you wouldn't wanna miss, so be sure to visit the app from your graphical browser as well to view the list of marked cities running Ubuntu Server. On release day (12th of Aug) it would be very cool to have every major city in the world marked on that map, so please spread the word as much as you can (yes that means retweet it, digg it, slashdot it, tell you mom about it ...etc)

Tuesday, August 3, 2010

bash oneliner, get GPS location + street address

Hey there folks,

It's been quite some time since I last blogged, just been busy with $reallife. Today I'll show you how to an answer the eternal question of "Where am I" from the comfort of your bash shell

The following code only works if:
- You run it in a root shell (Ubuntu users do: "sudo -i" then paste it)
- You are connected via Wifi to some access point
- Your wireless adapter is called wlan0 (otherwise replace it with the correct name)
- You're using a Linux system or something similar (i.e. Windows won't really work here)

et voila

/bin/echo '{"version": "1.1.0","host": "","request_address": true,"address_language": "en_GB", "wifi_towers": [{"mac_address": "' $( iwlist wlan0 scan | grep Address | head -1 | awk '{print $5}' | sed -e 's/ //g' ) '","signal_strength": 8,"age": 0}]}' | sed -e 's/" /"/' -e 's/ "/"/g' > /tmp/post.$$ && curl -X POST -d @/tmp/post.$$ | sed -e 's/{/\n/g' -e 's/,/\n/g'

I didn't really spend much time cleaning it up, since I'm busy, so that's like the first thing that worked. If any of you guys can skip writing to the file, let me know and I'll update it

PS: If the returned information is wrong, or some kind of "unknown" .. Consider yourself lucky, very lucky! That means Google does not (yet?) know where your wifi AP is. For the rest of us .. tin-foil all the way