On Fri, Apr 15, 2022, 21:56 DJ Chase <u9000@tilde.team> wrote:
Hi all,
In the spirit of this list's rejuvenation, I thought I'd share a fun
project I did recently with ~team.
For context: I use a flip-phone (it's much less distracting than a
smartphone), so I cannot use an app or browser to check the weather when
getting dressed every morning. And I can't call NOAA to get the weather
because the dial-a-forecast number for my state is out of service.
So, I made a script that texts me the weather and made a cronjob to run
that every morning. The script was surprisingly simple:
#!/bin/sh
WEATHER="/tmp/$(uuidgen)"
curl --silent https://wttr.in/<LOCATION>.png?1Fqn > "$WEATHER"
mutt -a "$WEATHER" -- 8005551234@mms-gateway.example
rm "$WEATHER"
I used wttr.in here because its api is increadibly simple (it's
literally the same thing as its UI). This does mean, though, that I had
to send it as an image because wttr returns formatted text that wraps
horrible.
Many cell providers have an email to SMS/MMS gateway, so it was really
easy to send a text; it should be easy to find this via a search engine.
I also used mutt here instead of something POSIXly correct to make
attachments simpler — this is just a hack, after all.
Cheers,
--
DJ Chase (~u9000)
They, Them, Theirs