Live data from Hacker News

`curl wttr.in`: Weather in your terminal

github.com

81–90 of 147 posts

Re: `curl wttr.in`: Weather in your terminal

#82
post #43

Earlier quoted context omitted.

It's just cool but practically I never check weather until I'm about to leave home and then I'll just check a local weather app on my phone which should give more accurate and detailed info than a service that covers the entire world with presumably varying degree of accuracy.

but imagine if you're in a bunker hacking on your fav project, no artificial light and you wonder.. shall i go to the surface? you curl this website and, if tolerable weather conditions, you plan your ascent.

Than you need a webcam out there, with a thermometer in the field of view.

I live in a big city, it could be raining frogs in one part and a happy sunny day in the other and the best thing any weather report could say to me is 'expect rain'. And if I need to go it doesn't even matter what the report says or if I have/have not an umbrella with me.

Honestly for the last decade even if I look at the weather report I look not for the current conditions (I have eyes and windows) but what would be in a couple of hours, because temperature difference between 9PM and 3AM could be pretty significant.. and it doesn't even matter in winter and summer. *shrug_emoji*

Re: `curl wttr.in`: Weather in your terminal

#83

If only there's a $PS1 version

It might just be me, but I never saw the usefulness in widgets that shows the current weather, at your current location. I mean can’t you just look out the window? Stuffing a three days weather report into $PS1 might be to much information for a prompt.

I have to get up and walk to the window, so looking it up in the terminal is much faster. But I agree that it feels somewhat detached from nature. Also the thermometer at the window varies a lot with direct sunlight or wind, so i find these weather services give a better estimate to what i should be wearing when i go outside.

Re: `curl wttr.in`: Weather in your terminal

#84
post #76
post #75

Earlier quoted context omitted.

If you have a vulnerable terminal emulator, yes. Well, the same holds for every web site you visit if you have a vulnerable browser.

Unless there were an escape sequence meaning "execute this". I am not aware such beast would exist.

It can happen by accident, eg. https://www.openwall.com/lists/oss-security/2016/11/04/12

Archived version of the linked commit: https://archive.softwareheritage.org/browse/revision/b80bedc... (which removes the feature entirely)

Re: `curl wttr.in`: Weather in your terminal

#85

Earlier quoted context omitted.

which begs the quotation: is there such a thing as a “firewall” for terminals? my idea is to limit the terminal’s cpu usage so that any breach does not spread quickly in the system, and maybe limit the terminal’s network access, but leave the shell out of it. idk if the last part is possible.

Run it in a container?

Containers do not sanitize what programs send to the terminal emulator

Re: `curl wttr.in`: Weather in your terminal

#86

If only there's a $PS1 version

It might just be me, but I never saw the usefulness in widgets that shows the current weather, at your current location. I mean can’t you just look out the window? Stuffing a three days weather report into $PS1 might be to much information for a prompt.

I’m reminded of the old discussion of which clock program for X11 consumed the least resources and screen size. It concluded with something like: “Of course, the clock which consumes no resources, and does not take any screen space, is the clock which hangs on your wall.”.

Re: `curl wttr.in`: Weather in your terminal

#87

Earlier quoted context omitted.

This is true of anything that ever renders to your terminal. I'm not sure this class of issue is worth worrying about, generally. Sure, these are neat and scary examples. Have you seen some of the recent GPU driver ACEs? Better not render any graphics! A generalization of this is "receiving information from third parties can lead to security issues" which is of course true. Untrusted inputs are always untrusted. Pipi…

> Better not render any graphics! Unironically a good idea. Graphics have always been a mistake - most engineers would agree that if we stuck with very basic output, our software would be in a much better place than today (and more usable, too!)

Engineers are not UX designers, so their opinion on UX has little value imo.

Re: `curl wttr.in`: Weather in your terminal

#88

so the obvious (for me) thing to try was: watch -n 600 -c 'curl -s v2.wttr.in/' This ALMOST works, but somehow it messes up the formatting for me. For some reason watch doesn't pass through formatting cleanly or so?

This is not a problem with wttr.in, this is a problem of `watch`. It is a known issue: it can't render ANSI output. You can try to run it with any command that has ANSI output, and you will see it. As a simple alternative, you write your own 'watch' like this: while true; do curl -s wttr.in; sleep 60; clear; done

When writing these things, I prefer using the “sleep” command as the while condition. This way, the loop is easier to break out of. I.e. when I press Ctrl-C, the sleep command returns a non-zero exit code, and the while loop terminates gracefully:

  while sleep 60; do clear; curl -s wttr.in; done
Otherwise, I very often get a loop which stubbornly refuses to abort, and I have to hammer both Ctrl-C and Ctrl-\ to make it stop. The downside is, of course, that I have to wait 60 seconds (in this case) the first time. When this is a problem, I just unroll the loop slightly and add an extra invocation to the beginning:

  clear; curl -s wttr.in; while sleep 60; do clear; curl -s wttr.in; done
This could be generalized into a terminal watch function:

  termwatch(){ delay="$1"; shift; clear; "$@"; while sleep "$delay"; do clear; "$@"; done; }

  termwatch 60 curl -s wttr.in

Re: `curl wttr.in`: Weather in your terminal

#89
post #57
post #23

Earlier quoted context omitted.

I'm speechless. I never expected running curl could lead to such a security disaster.

The terminal (or rather terminal emulation) is a mistake, people should stop glorifying it. It has no inherent value, beyond being able to run historical software that was bound to a terminal. Most of all one should stop confusing the terminal and the shell, which remains an interesting concept.

I have no idea what that comment means.

Re: `curl wttr.in`: Weather in your terminal

#90
post #13

This is really neat... vim ~/.bashrc ``` alias weather='/usr/bin/curl wttr.in' ``` :wq and now: weather

Heh, I did the exact same thing. I actually did alias weather="curl wttr.in && curl v2.wttr.in && curl v3.wttr.in" so that it shows me the temperature chart and map as well. Well, v3's map isn't working so I commented that out for now but they say it should work in the future.

if you do

curl wttr.in/:help

Tou get a help document, which also shows you a way to get a suggested bash function; to wit:

curl wttr.in/:bash.function

Post reply on HN