Last active
November 29, 2017 01:23
-
-
Save chmanie/6343547a0169e9b6167d to your computer and use it in GitHub Desktop.
Get your local weather (in the command line!)
This file contains 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
# Weather! | |
# uses https://github.com/alexreisner/geocoder | |
# and https://github.com/robmathers/WhereAmI | |
function wthr | |
set LOC (whereami) | |
set LAT (echo $LOC | cut -d" " -f2) | |
set LON (echo $LOC | cut -d" " -f4) | |
set CITY (geocode -s nominatim "$LAT,$LON" | grep -Eo '^City(.+)' | cut -d: -f2 | xargs | tr ' ' '-') | |
curl -4 http://wttr\.in/$CITY | |
end |
This file contains 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 | |
# Weather (Mac OS X only!) | |
# uses https://github.com/alexreisner/geocoder | |
# and https://github.com/robmathers/WhereAmI | |
LOC=$(whereami) | |
LAT=$(echo $LOC | cut -d" " -f2) | |
LON=$(echo $LOC | cut -d" " -f4) | |
CITY=`geocode -s nominatim "$LAT,$LON" | grep -Eo '^City(.+)' | cut -d: -f2 | xargs | tr ' ' '-'` | |
curl -4 http://wttr\.in/$CITY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment