Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Want to be a cool digital nomad, or laptop adventurer? Add your geolocation to your git commits:
#!/bin/bash
#http://iharder.sourceforge.net/current/macosx/locateme/
#copy paste this into the .git/hooks/prepare-commit-msg file
#install locateme into your project directory
LAT=`./LocateMe -f "{LAT}"`
LNG=`./LocateMe -f "{LON}"`
URL="http://maps.googleapis.com/maps/api/geocode/json?latlng=$LAT,$LNG&sensor=false"
ADDRESS=`eval "curl -s \"$URL\" | grep formatted_address | head -n 1 | sed 's/\"//g' | sed 's/,//g'"`
ADDRESS=`echo $ADDRESS | awk -F' : ' '{print $2}'`
echo "$ADDRESS: $(cat $1)" > $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment