<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Graph on falkp.no/blog</title>
    <link>/blog/tags/graph/</link>
    <description>falkp.no/blog (Graph)</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    
      

      
    

    
    <lastBuildDate>Tue, 31 May 2016 00:00:00 +0000</lastBuildDate>
    
    <atom:link href="/blog/tags/graph/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Using finger service the wrong way</title>
      <link>/blog/posts/using_finger_service_the_wrong_way/</link>
      <pubDate>Tue, 31 May 2016 00:00:00 +0000</pubDate>
      
      <guid>/blog/posts/using_finger_service_the_wrong_way/</guid>
      <description>&lt;h2 id=&#34;overview&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#overview&#34;&gt;
        #
    &lt;/a&gt;
    Overview
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re doing this, you&amp;rsquo;re doing it wrong&amp;hellip;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;2016-05-31 10:19:45.493314 Client 92.x.x.192 hamburg, germany/hamburg/hamburg
2016-05-31 10:19:48.443380 Client 74.x.x.189 greensboro, united_states/north_carolina/greensboro
2016-05-31 10:19:56.733260 Client 50.x.x.50 beaverton, united_states/oregon/beaverton
2016-05-31 10:19:56.745653 Client 50.x.x.50 beaverton, united_states/oregon/beaverton
2016-05-31 10:19:56.759656 Client 50.x.x.50 beaverton, united_states/oregon/beaverton
2016-05-31 10:19:56.819283 Client 50.x.x.50 beaverton, united_states/oregon/beaverton
2016-05-31 10:20:16.287744 Client 5.x.x.13 kaiserslautern, germany/rhineland-palatinate/kaiserslautern
2016-05-31 10:20:35.182942 Client 85.x.x.140 katowice, poland/silesia/katowice
2016-05-31 10:20:47.029550 Client 193.x.x.226 oslo, norway/oslo/oslo/oslo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Lots of people use the finger service &lt;strong&gt;@graph.no&lt;/strong&gt; in an automated way. That&amp;rsquo;s quite alright, it&amp;rsquo;s what it&amp;rsquo;s there for. As an example:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;sd_full.jpg&#34; alt=&#34;@graph.no used in an automated way at the Computer Science department at the KIT Karlsruhe&#34;&gt;&lt;/p&gt;
&lt;p&gt;But if you&amp;rsquo;re asking for the same data five times a second (until you get blocked by my firewall for a minute), you have to check your code. The data is at best changing every ~30 minutes.&lt;/p&gt;
&lt;p&gt;A likely scenario is putting it in &lt;strong&gt;screen&lt;/strong&gt;/&lt;strong&gt;tmux&lt;/strong&gt; status line. If you do that, you need to change how often your terminal multiplexer is updating the status line. A better way is to have a cron script fetching the data, and storing it in i.e. &lt;code&gt;/tmp/weather&lt;/code&gt; every 30-60 minutes, and then have your status line read from that.&lt;/p&gt;
&lt;p&gt;Another scenario could be people running it in &lt;strong&gt;watch&lt;/strong&gt;, which by default updates every two seconds. Also wrong. Please use -n 600 more.&lt;/p&gt;
&lt;p&gt;If you fetch the data, and &lt;strong&gt;grep&lt;/strong&gt; out what you need, then fetch the data once, and &lt;strong&gt;grep&lt;/strong&gt; all you like. Don&amp;rsquo;t fetch for each &lt;strong&gt;grep&lt;/strong&gt;. An example of this can be seen in the client &lt;a href=&#34;https://github.com/ways/pyyrascii/blob/master/graph.sh&#34;&gt;graph.sh&lt;/a&gt;, which fetches the data, &lt;strong&gt;sed&lt;/strong&gt; a lot and present it using unicode weather symbols and colors.&lt;/p&gt;
&lt;p&gt;Feel free to contact me if you need scripts/examples or have questions.&lt;/p&gt;
&lt;p&gt;Also, don&amp;rsquo;t feel ashamed, beaverton, you&amp;rsquo;re not alone in hammering me. I just don&amp;rsquo;t have any way to contact users. I still love you all. =)&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>graph.no - Weather forecast via finger</title>
      <link>/blog/posts/graph_no___weather_forecast_via_finger/</link>
      <pubDate>Sat, 13 Dec 2014 00:00:00 +0000</pubDate>
      
      <guid>/blog/posts/graph_no___weather_forecast_via_finger/</guid>
      <description>&lt;h2 id=&#34;the-idea&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#the-idea&#34;&gt;
        #
    &lt;/a&gt;
    The idea
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;http://yr.no&#34;&gt;Yr.no&lt;/a&gt; has a brilliant &lt;a href=&#34;http://www.yr.no/place/Norway/Oslo/Oslo/Oslo/hour_by_hour.html&#34;&gt;hour by hour&lt;/a&gt; view. A simple picture where you get all info you need for planning your next 48 hours.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;meteogram.png&#34; alt=&#34;Yr.no&#34;&gt;&lt;/p&gt;
&lt;p&gt;They also give out all their &lt;a href=&#34;http://om.yr.no/verdata/free-weather-data/&#34;&gt;weather data for free&lt;/a&gt;! Having a special fascination for the command line, I wondered if I could represent the same information in a basic, ASCII, 80x22 terminal.&lt;/p&gt;
&lt;h2 id=&#34;development&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#development&#34;&gt;
        #
    &lt;/a&gt;
    Development
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;Earlier I&amp;rsquo;d made my first telnet service for keeping an eye on the status of the office coffee pot (&lt;a href=&#34;http://coffee.graph.no&#34;&gt;coffee.graph.no&lt;/a&gt; / 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 &lt;a href=&#34;http://www.thelinuxblog.com/quickly-checking-the-weather-with-telnet/&#34;&gt;wunderground&lt;/a&gt;, which I discovered later, but one that could be used in an automated sense.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;I also tried to allow for passing an input so that one could run echo &amp;ldquo;oslo&amp;rdquo; | nc graph.no telnet. Can&amp;rsquo;t remember why that didn&amp;rsquo;t work.&lt;/p&gt;
&lt;p&gt;Then I discovered the &lt;a href=&#34;https://en.wikipedia.org/wiki/Finger_protocol&#34;&gt;finger protocol&lt;/a&gt;. Or rather how it actually worked. It&amp;rsquo;s simply telnet with one input, the user name. Perfect.&lt;/p&gt;
&lt;p&gt;The solution then became a python daemon, listening at the standard finger port, making a call to YR&amp;rsquo;s free API and caching the results. I found a &lt;a href=&#34;https://github.com/ways/pyyrlib&#34;&gt;python lib for using the API&lt;/a&gt;, so I could get right on to presenting the data.&lt;/p&gt;
&lt;p&gt;The first working code gave:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;finger1.jpg&#34; alt=&#34;Graph.no v.1&#34;&gt;&lt;/p&gt;
&lt;p&gt;After a few long nights it became more or less how it is today:&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;finger2.png&#34; alt=&#34;Current graph.no&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;press&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#press&#34;&gt;
        #
    &lt;/a&gt;
    Press
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I announced it at &lt;a href=&#34;http://tillegg.yr.no/application/pyyrascii/&#34;&gt;tillegg.yr.no&lt;/a&gt; (first runner up for top rated), and at &lt;a href=&#34;http://www.reddit.com/r/linux/comments/ouday/retro_weather_forecast_finger/&#34;&gt;reddit.com/r/linux&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After that the part owner of YR, &lt;a href=&#34;http://nrk.no&#34;&gt;NRK&lt;/a&gt;, which has a blog discussing new media, the tech behind what they do, etc. called &lt;a href=&#34;http://nrkbeta.no&#34;&gt;NRK Beta&lt;/a&gt;, wrote an article about it: &lt;a href=&#34;http://nrkbeta.no/2012/04/06/old-skool-vaervarsling/&#34;&gt;Old Skool-værvarsling&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also been used in a hackathon for littleprinter, see &lt;a href=&#34;http://twitpic.com/a298vv&#34;&gt;twitpic&lt;/a&gt; and &lt;a href=&#34;http://www.flickr.com/photos/knolleary/7473137758/in/photostream/&#34;&gt;flickr&lt;/a&gt;, and in various screenshot threads in forums.&lt;/p&gt;
&lt;h2 id=&#34;my-use&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#my-use&#34;&gt;
        #
    &lt;/a&gt;
    My use
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;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&amp;rsquo;ve used in tmux/screen status bars.&lt;/p&gt;
&lt;h2 id=&#34;improving-on-tech-from-the-seventies&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#improving-on-tech-from-the-seventies&#34;&gt;
        #
    &lt;/a&gt;
    Improving on tech from the seventies
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I can&amp;rsquo;t use unicode, colors, a larger display, as that would make it incompatible with the original goal of the project. But I&amp;rsquo;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 &lt;a href=&#34;https://github.com/ways/pyyrascii/blob/master/graph.sh&#34;&gt;graph.sh&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;finger3.png&#34; alt=&#34;Client graph.sh&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;stats&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#stats&#34;&gt;
        #
    &lt;/a&gt;
    Stats
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;I do get that there isn&amp;rsquo;t a big market for this. Especially when it&amp;rsquo;s so hard to use on a phone (with for example &lt;a href=&#34;https://play.google.com/store/apps/details?id=ca.lotuspond.finger&#34;&gt;Unix Finger Client&lt;/a&gt;), and there are such beautiful alternatives as i.e. &lt;a href=&#34;http://forecast.io/&#34;&gt;forecast.io&lt;/a&gt;. Oh, yes, not everyone uses terminals anymore either.&lt;/p&gt;
&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s an excerpt from my logs the day before I wrote this:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;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,
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;give-it-a-try&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#give-it-a-try&#34;&gt;
        #
    &lt;/a&gt;
    Give it a try
&lt;/div&gt;
&lt;/h2&gt;
&lt;p&gt;Now it&amp;rsquo;s time for you to try.&lt;/p&gt;
&lt;h3 id=&#34;linux&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#linux&#34;&gt;
        ##
    &lt;/a&gt;
    Linux
&lt;/div&gt;
&lt;/h3&gt;
&lt;p&gt;On Linux you probably have one of these installed:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e2e4e5;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;telnet
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;netcat / nc
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;finger
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If not, it&amp;rsquo;s usually a simple &lt;code&gt;sudo apt-get install finger&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;os-x&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#os-x&#34;&gt;
        ##
    &lt;/a&gt;
    OS X
&lt;/div&gt;
&lt;/h3&gt;
&lt;p&gt;Look for the commands above.&lt;/p&gt;
&lt;h3 id=&#34;windows&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#windows&#34;&gt;
        ##
    &lt;/a&gt;
    Windows
&lt;/div&gt;
&lt;/h3&gt;
&lt;p&gt;On Windows 7 you can &lt;a href=&#34;http://social.technet.microsoft.com/wiki/contents/articles/910.windows-7-enabling-telnet-client.aspx&#34;&gt;activate telnet&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;for-all-oses&#34; &gt;
&lt;div&gt;
    &lt;a href=&#34;#for-all-oses&#34;&gt;
        ##
    &lt;/a&gt;
    For all OSes
&lt;/div&gt;
&lt;/h3&gt;
&lt;p&gt;Try one of the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e2e4e5;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;finger newyork@graph.no
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff5c57&#34;&gt;echo&lt;/span&gt; newyork | telnet@graph.no finger
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ff5c57&#34;&gt;echo&lt;/span&gt; newyork | netcat graph.no finger
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If those won&amp;rsquo;t work, try:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e2e4e5;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;telnet graph.no &lt;span style=&#34;color:#ff9f43&#34;&gt;79&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And then type &amp;ldquo;newyork&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Have a look at the help section for more info:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#e2e4e5;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;finger @graph.no
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
  </channel>
</rss>
