Skip to content

Instantly share code, notes, and snippets.

@chmanie
Last active November 29, 2017 01:23
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chmanie/6343547a0169e9b6167d to your computer and use it in GitHub Desktop.
Save chmanie/6343547a0169e9b6167d to your computer and use it in GitHub Desktop.
Get your local weather (in the command line!)
# 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
#!/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