[opensource] Fwd: [colug-432] Command-line Snow Emergency Level​

wallace.586 at osu.edu wallace.586 at osu.edu
Wed Feb 18 10:36:51 EST 2015


Fun tidbit from COLUG this morning



—
Sent from Mailbox

---------- Forwarded message ----------
From: "Rob Funk" <rfunk at funknet.net>
Date: Wed, Feb 18, 2015 at 10:33 AM
Subject: [colug-432] Command-line Snow Emergency Level
To: "colug-432 at colug.net" <colug-432 at colug.net>

> In case you need a command to quickly get the current Franklin County
> snow emergency level:
> #!/bin/sh
> # Franklin County Snow Emergency Level
> #
> # Required commands:
> #     curl
> #     xpath (from libxml-xpath-perl package)
> #     html2, 2xml (both from xml2 package)
> tmpfile="/tmp/snow-$$.xhtml"
> url=https://sheriff.franklincountyohio.gov/info/snow-emergency-levels.cfm
> xhtml_cleanup() {
>     html2 | 2xml
> }
> ##
> curl -s "$url" | xhtml_cleanup > "$tmpfile"
> status=$?
> if [ $status -gt 0 ]; then
>     rm -f "$tmpfile"
>     exit $status
> fi
> xpath -q -e "//div[@class='main']/div//text()" "$tmpfile"
> rm "$tmpfile"
> #################################################################
> Those two package names are on Ubuntu. YMMV.
> Sending you a message when this changes, or handling other counties,
> are left as an exercise for the reader.
> _______________________________________________
> colug-432 mailing list
> colug-432 at colug.net
> http://lists.colug.net/mailman/listinfo/colug-432
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cse.ohio-state.edu/pipermail/opensource/attachments/20150218/76003737/attachment.html>


More information about the Opensource mailing list