Curl Wttr.in
github.com
github.com
curl wttr.in/Moon
Shows current lunar phase.I use Termux[0] on my phone with curl installed. Pretty handy.
Also, check out rate.sx[1] from the same author:
curl rate.sx
Shows information about current exchange rates of cryptocoins.More similar console services: https://github.com/chubin/awesome-console-services
[0]: https://termux.com/
curl ipaddress.sh curl findip.wincurl ifconfig.co (shows your public ip)
Not sure if it's temporary down or fully off.
myip is aliased to `dig +short myip.opendns.com @resolver1.opendns.com'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)
w () {
curl -s "wttr.in/$1?M1qF"
}EDIT: I just realised that "they" is actually you!
w () {
curl -s "wttr.in/${*// /+}"
}
to make it work with places that have spaces in their name. E.g. w new yorkw() { ( IFS=+; curl wttr.in/"$*";); }
curl https://poptart.spinda.netAs 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!
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.)
curl() { [ -t 1 ] && curl "$@" | sanitize || curl "$@"; }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.
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.
[2] https://git.sr.ht/~jamesponddotco/dotfiles/tree/master/.loca...
Better late than never, I hope.
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”.
(Invoke-WebRequest -Uri wttr.in).content
from Powershell. Why not use the happy path?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
curl wttr.in
But that might just be (my) programming. 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.
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.
irm wttr.in
irm is an alias for Invoke-RestMethod which is similar to Invoke-WebRequest but better for non-html responses like json or plain text. Invoke-RestMethod http://wttr.in
For some reason they recommend that early in the readme, but not down in https://github.com/chubin/wttr.in#windows-users where they discuss various issues on Windows.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-...
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.
and for the white background:
curl wttr.in/?I
I mean, we all now those "geolocate me" things on websites, but I've never encountered a single page where it worked; it's always hilariously all over the place (shows the headquarter of my provider, or just locates me in Frankfurt at the DE-CIX).
But wttr.in is different. I wonder what the magic ingredient is and why no one else seemingly has it.
curl ga.wttr.in/limerick
and the curlable directory is almost there
As an interim solution, you can use this:
curl https://raw.githubusercontent.com/chubin/awesome-console-services/master/README.mdSo
curl --user-agent "" wttr.in
just serves you unformatted HTML. curl --user-agant "" wttr.in?A
for that.The `A` option enforces ANSI output (curl wttr.in/:help for more)
(btw there's a typo, should be --user-agent)
finger city@graph.no
also includes forecasts (try city+24).
curl rate.sx
curl qrenco.de
and the rest from https://github.com/chubin/awesome-console-services
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
alias godstatus='curl wttr.in'
weather ()
{
curl http://wttr.in/${1:-LAX}
}