If you have a Mac laptop, this is one of the first things you should install. MarcoPolo can detect your location through several factors (wifi, usb, bluetooth, gps, monitors, ambient light, ip, bonjour, etc…) and even from combinations. It then allows you to do several actions according to the location.
I use it to mount network drives, mute or unmute the system, to perform backups, to turn wifi on or off (when I’m on cable or not), but there are a lot of actions doable, and the obvious shell script that makes the possibilities unlimited.