News for hackers. Stuff that matters.
Re:Curl Wttr.in by ikornaselur on Friday June 26, 2020 @04:20AM (#23649861)
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)

Re:Curl Wttr.in by mimimi31 on Friday June 26, 2020 @05:27AM (#23650191)
You could do something like this

  w () {
    curl -s "wttr.in/${*// /+}"
  }
to make it work with places that have spaces in their name. E.g.

  w new york
Re:Curl Wttr.in by igor_chubin on Friday June 26, 2020 @05:40AM (#23650251)
Just use IFS for this

w() { ( IFS=+; curl wttr.in/"$*";); }

Re:Curl Wttr.in by ikornaselur on Wednesday July 08, 2020 @11:03AM (#23770566)
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!
Re:Curl Wttr.in by augusto-moura on Friday June 26, 2020 @10:38AM (#23652452)
Pretty neat, it shadows the `w` command however. Not that is that much useful in a personal computer
Re:Curl Wttr.in by igor_chubin on Friday June 26, 2020 @04:34AM (#23649927)
Just add `F` to the options, and you don't need `| head -17` then
Re:Curl Wttr.in by ikornaselur on Wednesday July 08, 2020 @10:58AM (#23770494)
Oh, awesome! I don't know if they added this after I created the function or if I just didn't notice it.

EDIT: I just realised that "they" is actually you!

Re:Curl Wttr.in by martijn9612 on Friday June 26, 2020 @05:07AM (#23650086)
I wasn't sure what F you were talking about, if other people are wondering, the new command would be:

  w () {
     curl -s "wttr.in/$1?M1qF"
  }