Skip to content

Instantly share code, notes, and snippets.

@StefKors
Created June 10, 2018 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StefKors/6db0dc7b4c58f491d8dad3b96ed77928 to your computer and use it in GitHub Desktop.
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:
#!/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