Saturday, June 2, 2012

Mount WebDAV resources with davfs2 and secure it with encfs

Number of online resources offering free remote storage facilities has seriously increased in the recent time and it continue to grow taking a good share from the Dropbox's marketspace. Dropbox has been on the cloud storage market since the early days but for many people a proprietary client offered by Dropbox is not acceptable. There are of course attempts to overcome such a drawback by implementing an open source client that is configurable to use different types of cloud storage facilities transparently to the user. An example for such a client is syncany.org. I've been waiting for the syncany.org project to reach a mature state for months but it seems like they are not making it in the near future. So I started to look for other possibilities to utilize cloud storage facilities using only standard means available on the operating system's level that would require no dedicated client to be installed. The rest of the article is devoted mainly to users of Unix-like OS's but there is a section in the end explaining how to mount and encrypt WebDAV resources on Windows platform.

Sunday, February 26, 2012

Digital Picture Frame as a router status display

A 320x240 cheap (2,90€ by pearl.de) digital picture frame attached to a router is a very useful addition to show router's status information. The DPF display driver is already integrated into the lcd4linux project that makes it easy to use the frame. This for example is how it works for me:

[Image]


Some details regarding DPF hacking can be found here (the page is in German)
Although lcd4linux is a powerful tool I'm still looking for a way to build complex dynamic menu structures to be able to control MPD from my remote, i.g to be able to navigate visually through the MPD database and select items into the playlist. And it seems like the lcd4linux is not powerful enough to do such things. I'll add some additional notes if I find a solution.

Update: my lcd4linux.conf for this layout is here
Update2: the digit's font is Impact, 48 points
Update3: I was asked to add some info about weather parsing

Well, first of all I have a script that is called when WAN interface goes up:

Friday, June 10, 2011

A simple bash IRC logging bot

Couple of years ago I googled for a simple bash IRC logging bot that I could start on my router to log some channels. I've found a very simple script that worked but didn't handle PINGs from the server. So I extended it a bit trying to keep it as simple as possible.

Thursday, March 3, 2011

Encrypting with the openssl in bash

With a bit of commandlinefu it becomes easy to encrypt and decrypt files with the strong 256 bit aes algorithm using openssl.

Add the following into your ~/.bashrc
# crypting functions
function encrypt {
  if [ -t 0 ]; then
    # interactive
    local fname="$1"
    shift
    openssl aes-256-cbc -salt -in "$fname" -out "${fname}.enc" $@
  else
    # piped
    perl -e 'use IO::Select; $ready=IO::Select->new(STDIN)->can_read();'
    openssl aes-256-cbc -salt $@
  fi
}
function decrypt {
  if [ -t 0 ]; then
    # interactive
    local fname="$1"
    shift
    openssl aes-256-cbc -d -in "$fname" -out "${fname%\.*}" $@
  else
    perl -e 'use IO::Select; $ready=IO::Select->new(STDIN)->can_read();'
    openssl aes-256-cbc -d $@
  fi
}

and source it to let changes take effect (source ~/.bashrc).

Thursday, January 27, 2011

collectd-mod-exec Part 5

Part 1
Part 2
Part 3
Part 4

In this final part I'm publishing a real world example of the collectd-exec usage - weather info collecting script.
I'm using yahoo weather api to get weather information because it sends back very concise xml formatted text file which is only 2k in size. The weather info is updated once per hour so I've added special logic to retrieve it once per hour and feed same values in between.

Wednesday, January 26, 2011

collectd-mod-exec Part 4

Part 1
Part 2
Part 3

There is only one thing left to explain - how to get notified if some values go out of scope. As an example I'm going to send notification emails if CPU temperature reaches 57 degree Celsius. This could be implemented with only one additional if statement and this would work perfectly if I only had one script that sends notifications. It would become cumbersome if I needed to edit multiple scripts to change say an email address where my notifications are sent. In other words the collecting and notification logics shall be separated. To  do this one can use 'PUTNOTIF' statement that shall be sent to the script STDOUT - exactly the same way like 'PUTVAL' is sent. Documentation of the 'PUTNOTIF' arguments can be found on the collect-exec module documentation page. Additionally there shall be some logic added to send notification after some time out period otherwise emails would be sent after each $COLLECTD_INTERVAL which is by default 30 seconds. Updated tmpcollect.sh script is shown below:

Monday, January 24, 2011

collectd-mod-exec Part 3

Part1
Part2

I'll continue with the tmpcollect.sh script from the second part of this How-To. First of all I want to optimize it a bit. Running sed two times is not very performant and is also not necessary. Updated script is shown below:

Friday, January 21, 2011

collectd-mod-exec Part 2

Part1

My router SBC is equipped with two temperature sensors to monitor cpu and board temperatures. Executing 'sensors' command produces the following result:
root@Alix:~# sensors
lm86-i2c-0-4c
Adapter: CS5536 ACB0
temp1:       +36.0 C  (low  =  +0.0 C, high = +70.0 C)
                      (crit = +85.0 C, hyst = +75.0 C)
temp2:       +42.5 C  (low  =  +0.0 C, high = +70.0 C)
                      (crit = +85.0 C, hyst = +75.0 C)
With a bit of the script-fu I'm stripping temperature values and feeding them into the database:

Thursday, January 20, 2011

collectd-mod-exec Part 1

Having some spare time I decided to write about powerful yet not well documented feature of the OpenWRT's luci-app-statistics plugin -- collectd-mod-exec module. This module allows collecting any type of data an external application could supply. In other words the module starts a user specified application which feeds collectd module with data. Principally having this module installed one could simulate all other collectd-mod-* modules.

Saturday, November 13, 2010

IR control for your router

There are no buttons on my router but very often I need to start some task without accessing the shell. For example I want to switch wireless interface off if I don't need it and the problem here is that I cannot switch it on again wirelessly because wireless interface is off. So I thought I need some kind of a one button USB keyboard or mouse but there is no such thing. Second thought was to use some kind of IR receiver with a remote control. As far as I already have a universal remote control Logitech Harmony 885 I only needed an IR receiver that is supported by Linux. So I bought one manufactured by TechniSat for 15,20Euro with delivery (just google for - TechniSat USB IR receiver)
[Image]