This project has a LaunchAgent for Mac OS X and a small script. So far the only thing it does is detecting a WiFi SSID change and changing your network location. Values are hard coded for my specific case, but I plan into making it configurable soon.
You can install, uninstall and reinstall it using the Makefile:
make install
make uninstall
make reinstall