Created
June 10, 2018 18:41
-
-
Save StefKors/6db0dc7b4c58f491d8dad3b96ed77928 to your computer and use it in GitHub Desktop.
Want to be a cool digital nomad, or laptop adventurer? Add your geolocation to your git commits:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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