Created
February 5, 2010 23:59
-
-
Save natebunnyfield/296402 to your computer and use it in GitHub Desktop.
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/sh | |
function strip_tags { | |
sed "s/<[^>][^>]*>//g; s/^ *//g" | |
} | |
function break_every_third_line { | |
awk '{ if ( NR % 3 == 0 || NR == 1 ) print "" } { print }' | |
} | |
function sentencecase { | |
gsed "s/\([^.]\s\)\([A-Z]\)/\1\l\2/g" | |
} | |
function strip_wind_info { | |
sed "s/[A-Z][^.]*mph[^.]*\.//g" | |
} | |
function prettify { | |
break_every_third_line | strip_tags | sentencecase | |
} | |
function wunderground { | |
URL="http://www.wunderground.com/cgi-bin/findweather/getForecast?query=66046"; | |
curl -s $URL | grep "forecast to be" | prettify | |
} | |
function wund { | |
URL="http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=66046"; | |
curl -s $URL | grep "title\|fcttext" | prettify | strip_wind_info | |
} | |
wunderground && wund & | |
wunderground|say && wund|say | |
sleep .7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment