graph.no - Weather forecast via finger
They also give out all their weather data for free! Having a special fascination for the command line, I wondered if I could represent the same information in a basic, ASCII, 80x22 terminal.
Earlier I’d made my first telnet service for keeping an eye on the status of the office coffee pot ( coffee.graph.no / telnet graph.no ). After that, I pondered for a while on how to allow for choosing location via such a limited protocol. I did not want to make a service that had to be used by hand, like wunderground, which I discovered later, but one that could be used in an automated sense.
I considered running one instance at each port for a subset of the Norwegian postal codes, like 1000, 2000, 3000, etc. Or even for each hundred. I was stopped in pursuing this by two limitations in xinitd: no support for responding to several ports with one config file, and trouble of passing on which port was used to the daemon.
I also tried to allow for passing an input so that one could run echo “oslo” | nc graph.no telnet. Can’t remember why that didn’t work.
Then I discovered the finger protocol. Or rather how it actually worked. It’s simply telnet with one input, the user name. Perfect.
The solution then became a python daemon, listening at the standard finger port, making a call to YR’s free API and caching the results. I found a python lib for using the API, so I could get right on to presenting the data.
The first working code gave:
After a few long nights it became more or less how it is today:
I mainly made it for personal use. I have it at home on a monitor above the door and on a monitor at work. There are also options for small, one-liner outputs, which I’ve used in tmux/screen status bars.
Improving on tech from the seventies
I can’t use unicode, colors, a larger display, as that would make it incompatible with the original goal of the project. But I’m fond of icons, so I made a client. Yes, a client for a finger weather service. It consists of some messy bash code to fetch, present and refresh the forecast using unicode and colors. You can find it in the git repo of the project, called graph.sh.
I do get that there isn’t a big market for this. Especially when it’s so hard to use on a phone (with for example Unix Finger Client), and there are such beautiful alternatives as i.e. forecast.io. Oh, yes, not everyone uses terminals anymore either.
Still I do seem to have gathered a few loyal followers. I even had to block a user once, for hammering the service at about every second.
Here’s an excerpt from my logs the day before I wrote this:
Date: 2014-12-12 Total hits today: 377 Unique IPs today: 11 Top 10 users with hitcount: 230 85.89.x.x 36 77.179.x.x 25 176.68.x.x 24 77.179.x.x 21 138.246.x.x 16 176.11.x.x 12 217.186.x.x 4 93.93.x.x 4 176.11.x.x 3 46.212.x.x Top 10 locations: 230 katowice, 72 dresden, 24 oslo, 21 munich, 14 karlskrona, 4 4730, 2 hurdal, 2 help, 1 trondheim, 1 time,
Give it a try
Now it’s time for you to try.
On Linux you probably have one of these installed:
telnet netcat / nc finger
If not, it’s usually a simple sudo apt-get install finger
Look for the commands above.
On Windows 7 you can activate telnet.
For all OSes
Try one of the following:
finger email@example.com echo newyork | firstname.lastname@example.org finger echo newyork | netcat graph.no finger
If those won’t work, try:
telnet graph.no 79
And then type “newyork”.
Have a look at the help section for more info: