Hacker News new | past | comments | ask | show | jobs | submit login
Weather in your terminal, with ANSI colors and Unicode symbols (github.com/fcambus)
145 points by fcambus on Oct 21, 2013 | hide | past | favorite | 48 comments



Obligatory reference to the awesome Powerline[1]. If you don't want to use Python there's also tmux-powerline[2] and vim-airline[3].

I've been using these for the last couple of years.

[1] https://github.com/Lokaltog/powerline

[2] https://github.com/erikw/tmux-powerline

[3] https://github.com/bling/vim-airline

EDIT: typo, spacing and autocorrect :/


I put ansiweather in the AUR[1] for Archlinux users.

[1] - https://aur.archlinux.org/packages/ansiweather-git/


Thank you kind Sir!


We're dyin' over here in the Seattle area: Current weather in Redmond => 282.77 °F

Maybe try metric? Current weather in Redmond => 282.77 °C

Perhaps it doesn't know about Redmond, WA. Let's try Seattle: Current weather in Seattle => 286.5 °F

It also seems to think it's sunny in Seattle right now. Umm, no.

EDIT: ah, no space after the comma in your location, otherwise it thinks you're on the surface of Venus.


The weather service reports the temperature in Kelvin.


Then why does Moscow report at -2? Russia's gotten so cold it's below absolute zero..

The comma edit does the trick.


I am thinking more and more about moving back to a text-only interface - previously I was very happy with mutt, tin, lynx (and links and w3m), centericq, etc, but only bash and vim stuck with me.

Yet with the advent of unicode, there are fewer needs for a graphical interface - stay for a weather app. A clutter-free desktop consisting of mostly bash, along with gnu screen (or the likes) and ssh (or the likes) to remotely connect to home, now that would be efficient!

Even better - a few weeks ago, I found out that for math stuff, stata on OSX can be used with a command-line.

[PS: As usual Frederic, totally awesome :-)]


>Yet with the advent of unicode, there are fewer needs for a graphical interface - stay for a weather app

Of course the line between graphical and text-only is blurry. I'd argue that even small inline graphics are still graphics and thus not text-only, no matter how they are technically implemented (unicode or some "real" graphics).

Personally I don't think we have to resort for using the unholy mixture of 70s and todays tech that console apps represent to get clutter-free desktop experience. More importantly I think we could get even more clean interfaces using full graphical capabilities if we'd get a good design ideology/guidelines to build upon. Just because mainstream GUI apps are stuck on WIMP idea doesn't mean that it would be the only way to approach GUI.


As far as I can tell, only modern equivalent of the terminal (a generic input/output device/program that can be used as the standard front end to an endless array of applications) that has gained any appreciable traction is the web browser. Any "modern terminal, but not actually a terminal" experience, using current tech, is going to be built on top of a web browser.

The browser is just the terminal though (which to be fair is a large piece of the puzzle); we still don't have the shell analog. The inadequacy of ChromeOS does not make me hopeful. ChromeOS is to the browser what midnight commander is to the terminal.


> Any "modern terminal, but not actually a terminal" experience, using current tech, is going to be built on top of a web browser.

You're describing Steven Wittens' TermKit proof-of-concept: http://acko.net/blog/on-termkit/


Yep for something like this I'm definitely for a text interface, and I had to do the same with a quick php cli script using yahoo's api. For some reason weather.com just keeps getting slower and slower. I switched to accuweather for a bit but got tired of it too.


Alfred is amazing, if you are on Mac. I would strongly suggest it.


For April Fools' I released cloudyfs -- weather reports in your file system. Its pretty primitive, but functional. Pardon my haskell, it's lousy.

http://github.com/bhickey/cloudyfs


     % cat ~/.ansiweatherrc
     location:Pittsburgh,Pa
     units:metric

     jim@lilly /home/jim/projects/external/ansiweather (master)[0] {+00% 58C} Mon 2013-10-21 15:39:50 0                                         
     % ./ansiweather       
      Current weather in Pittsburgh => 17.68 °C ☀  - Humidity => 33 % - Pressure => 1014 hPa 
    jim@lilly /home/jim/projects/external/ansiweather (master)[0] {+00% 59C} Mon 2013-10-21 15:39:52 0                                         
     % cat ~/.ansiweatherrc
     location:Pittsburgh,Pa
     units:imperial

     jim@lilly /home/jim/projects/external/ansiweather (master)[0] {+00% 58C} Mon 2013-10-21 15:40:00 0                                         
     % ./ansiweather       
      Current weather in Pittsburgh => 61.89 °F ☀  - Humidity => 47 % - Pressure => 985.97 hPa
Interesting that the humidity and pressure are different when using different units (err, the humity and pressure are in the same units regardless of the units setting, but the values are different).


Given that 17.68 C is only 63.83 F, i think you just hit two different data points.


That's my point. When you switch which units are used 2 different data points are used. (Though, I didn't say it that clearly.)

I didn't even think to convert the temp though, good call.


Did not work for me with the default .ansiweatherrc. I had to remove the fetch_cmd:... and use curl -s instead and then it worked.

https://github.com/fcambus/ansiweather/issues/3

Thanks for this, I had written a script to pull the weather from another site and placed it in my conky. It works but is quite ugly.


./ansiweather: line 76: jq: command not found

If you run into that on ubuntu, there does not appear to be an ubuntu package for jq. Binaries and source are available at http://stedolan.github.io/jq/download/


That's listed in the requirements section of the README


If you are on OS X and use Homebrew, install with 'brew install jq'


There is also prebuilt OSX binaries, http://stedolan.github.io/jq/download/


jq is in the software center in 13.10


How often does it make a http request? Every time PS1 is printed?


If you put it in your PS1 then it will make a request every time your PS1 is printed, but it shouldn't be hard to have it cache and check timestamps.


The author obviously does not live in California. I rarely check the weather since I know that it will be more or less the same as yesterday , or the day before, or the day before that...


I don't live in California, and I never worry about weather any further than looking outside to see what's on the horizon, as well as the mountains.

If it rains , it rains... If it doesn't, it doesn't.

If you sit around waiting for the rain to stop in Hilo, you'll never get anything done.


After I moved out of LA, I realized there is a thing called weather forecast.


I guess that helped with the smog forecast withdrawal.


I realize this is a weird question, but I've never understood the point of having an applet show you the current weather. Does your home have no windows?


That's an interesting question that I hadn't really thought about before. Aside from just being generally curious about the exact weather conditions, here are some things that I use it for:

1. I live in a small apartment, so during the humid summers in New England with computer equipment running, it stays consistently hot. The A/C is running more often than not. In those cases, it's nice to get a quick gauge of the temperature/humidity. For example, it might guide me in whether I want to have a cigar in the evening.

2. I find it useful to ascribe a quantitative value to weather like temperature, since it gives me an idea of what I need to wear if I'm going to be outside for any length of time. e.g., low 50s I can get by comfortably at an idle position with shorts, shoes and a sweatshirt, but low 40s requires pants to stay comfortable. It can be difficult to tell that by just stepping outside for a few seconds...

Sorry about the long-winded response, but your question was curiously provocative!


Looking out the window really only tells you whether you will be wet from rain or not. It doesn't help you determine how humid it is or even whether it will rain in the next few hours. It obviously depends on where you reside, but in my case, the weather could quickly turn wet and thundery even though its been sunny all day.


If you cycle to/from work, you'll soon get used to having an applet showing you the weather all along the route and judging when to make a dash to avoid the torrential rain and gale-force winds as you cross a narrow sea bridge.


In Montana, depending on the season, looking out the window can be a really lousy way to gauge the temperature. When the temperature can swing more than 20 degrees Fahrenheit in a day, it can easily mean the difference between needing a jacket or not.


Most of us weather/radio nuts in the US have been doing something similar for over a decade or more. There's several scripts written in Perl or Python that grab data from NOAA. (Or you can just program your ICOM with the local frequency and script it to respond to the CLI...)


I need this as an emacs extension. Would fit right next to my nyan cat progress bar.


And now you can have it there! https://github.com/aaron-em/weatherline.el


Ack! I love this, so lightweight. I don't mean to do a pony request here, but can anyone think of an easy way to get this into a garden-variety windows 7 desktop, like through a rainmeter script or news ticker?


Not what you asked, but Win7 has a desktop weather gadget.

More along the lines that you asked ...

- Install cygwin and run it in a bash terminal there. Probably some tweaking required, may or may not work. cygwin's minterm does display unicode.

- Translate it into python and run it from a dos terminal (or from cygwin). I don't think the regular cmd.exe or powershell will display unicode (I could be wrong), but a replacement like conemu does (just checked). If you like this weather thing you'll like conemu better anyway.


I wonder if RainMeter can host PowerShell.

http://stackoverflow.com/a/5808445



Reminds me of a project a friend of mine did recently for the hackMIT hackathon: http://hackmit.challengepost.com/submissions/18025-bashwunde... Has ASCII-art, but I don't think he's put the source up anywhere.


This is great!

I just made a pull request to add the ability to see the forecast for the upcoming week as well: https://github.com/fcambus/ansiweather/pull/11/files


I had to use an underscore for a space in my city name in the config file. It would be nice if it linked to the list of city names available. But I think the program is pretty awesome!


Go to http://openweathermap.org and find your city, then copy the name it says.


yeah, I had to put in an underscore for my city as well.


Great to see the weather in the title bar of my xterm, I often don't have the strength to look out the window.


Nice idea !

Now I can have a weather icon in my prompt.


Disappointed

     _( )_          _     
   _(     )_      _( )_
  (_________)   _(     )_
    \  \  \    (_________)
      \  \       \  \  \
                   \  \




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: