-
-
Save ttscoff/76e5d7efb60d7ac04350 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
# So you know whoami, but whereami? | |
# Relies on this handy hack <https://github.com/lindes/get-location> | |
latlong=$(/usr/local/bin/get-location 2> /dev/null \ | |
| sed -e 's/.*<\(.*\)>.*/\1/') | |
address=$(curl -Ss "http://maps.googleapis.com/maps/api/geocode/json?latlng=$latlong&sensor=false" \ | |
| grep formatted_address \ | |
| head -n 1 \ | |
| sed -e 's/[ \t]*"formatted_address" : "\(.*\)",/\1/') | |
echo "You're at $address" |
Installed. A little slow and slightly off, but I only have 2 GB of RAM on this 2009 MBA, and I live in Manhattan. Got this output (with numbers X'ed out):
You're at "formatted_address" : "XX West XXth Street, New York, NY XXXXX, USA",
Is that correct? Seems somewhat contrary to your intentions. Thanks for the neat tool, though!
@ttscoff get-location seems to not work on Yosemite. Not expecting compatibility at this point, and it's not even a tool you wrote, but any suggestions? Seems like a fun script.
@sjsyrek must be a difference in the output for you. I just did a quick regex with sed based on the only address I was working with. I'll try and test with some other output.
@CameronBangs I haven't tried it, but it can't be too tough to fix. CoreLocation still exists and it's not a complex program. Maybe @lindes will have a chance to take a look before the release…
You'll need get-location (and the Command Line Tools to compile it) to make this work. It's cool when it does, though.