dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 1ea3085bd30d6e0716d6f5530facdaf12c7f42e8
parent c67c01177281a1d283a6c6b0fdb8a35c3fa415e0
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Thu,  7 Feb 2019 14:08:08 +0100

Update mailcap and forecast

Diffstat:
Mlinks/.mailcap | 6++----
Mlinks/bin/forecast | 26+++++++++++++++++---------
2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/links/.mailcap b/links/.mailcap @@ -6,11 +6,9 @@ text/html; w3m -I %{charset} -T text/html; copiousoutput; needsterminal text/plain; cat %s; copiousoutput text/*; vim %s; needsterminal -# MS Word documents -#application/msword; ~/.mutt/view_attachment.sh '%s' "-" '/Applications/TextEdit.app' +# Office documents application/msword; ~/.mutt/view_attachment.sh '%s' "-" -application/vnd.openxmlformats-officedocument.wordprocessingml.document; ~/.mutt/view_attachment.sh '%s' "-" -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; ~/.mutt/view_attachment.sh '%s' "-" +application/vnd.openxmlformats-officedocument.*; ~/.mutt/view_attachment.sh '%s' "-" # Images image/jpg; ~/.mutt/view_attachment.sh '%s' jpg diff --git a/links/bin/forecast b/links/bin/forecast @@ -2,9 +2,14 @@ # vim: ft=sh: set -e +# DMI +#zipcode=7700 # Thisted +default_zipcode=9520 # Skoerping -# NWS: Plainsboro -#url='http://f1.weather.gov/meteograms/Plotter.php?lat=40.3308&lon=-74.5647&wfo=PHI&zcode=NJZ012&gset=20&gdiff=10&unit=0&tinfo=EY5&ahour=0&pcmd=11011111111110100000000000000000000000000000000000000000000&lg=en&indu=3!1!1!&dd=&bw=&hrspan=48&pqpfhr=6&psnwhr=6' +function show_help { + echo "usage: ${0##*/} [radar | 3-9 | wind] [ZIPCODE]" + echo "gets DMI forecast, with ZIPCODE=$default_zipcode by default" +} if command -v open &>/dev/null; then open=open @@ -13,9 +18,6 @@ elif command -v xdg-open &>/dev/null; then else open="echo" fi -# DMI -#zipcode=7700 # Thisted -default_zipcode=9520 # Skoerping function get_url { echo "http://servlet.dmi.dk/byvejr/servlet/byvejr_dag1?by=${1}&mode=long&eps=true" @@ -26,9 +28,17 @@ if [ $# -gt 0 ]; then $open "http://www.dmi.dk/vejr/maalinger/radar-nedboer/" exit 0 elif [ "$1" == "3-9" ]; then - url="http://servlet.dmi.dk/byvejr/servlet/byvejr?by=${default_zipcode}&tabel=dag3_9&eps=true" + if [ $# -gt 1 ]; then + zip="$2" + else + zip="$default_zipcode" + fi + url="http://servlet.dmi.dk/byvejr/servlet/byvejr?by=${zip}&tabel=dag3_9&eps=true" elif [ "$1" == "wind" ]; then url="http://servlet.dmi.dk/bv/servlet/bvImage?stat=6065&param=wind" + elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then + show_help + exit 0 else url=$(get_url $1) fi @@ -37,8 +47,6 @@ else fi tmpfile=$(mktemp).png -curl --location "$url" \ +curl --silent --location "$url" \ --output "$tmpfile" $open "$tmpfile" - -#http://servlet.dmi.dk/byvejr/servlet/byvejr?by=9520&tabel=dag3_9&eps=true