#!/bin/bash #install duplicity: #sudo apt-get install duplicity #sudo apt-get install python-pip #sudo pip install paramiko export PASSPHRASE=MYSECRETPASSPHRASE duplicity --num-retries 20 /home/myHomeDir sftp://USERNAME@MYSERVER//home/myHomeDir/duplicity unset PASSPHRASE #amend the following to your crontab for regular backups at 3.am (issuing 'crontab -e') #0 3 * * * /path/to/script/duplicity_backup.sh

This blog is supposed to be a collection of random, unrelated, little ideas, thoughts, and discoveries, which I assume to be helpful to a negligible part of the world's population and wish to share out of pure altruism. If posts appear really weird, maybe you have the wrong kind of humor. Many of the posts are science/technology related. If you are opposed to that, stop reading here! Comments, criticism, corrections, amendments, questions are always welcome.
2016-01-31
2015-09-06
QR codes for wireless lan access
Do you share your wireless lan with friends and family and still want to maintain a policy of frequently changing your wireless lan password? They might find it tedious to type a new password into their mobile devices on every visit.
A way to make this more convenient is to use a QR Code, which can be scanned to make a device connect to your wireless lan automatically. This actually works for many mobile devices, especially Android smartphones.
A simple Python script that can be used to create such a QR code can be downloaded here. It requires qrencode and Imagemagick. An Android QR code reader, which I have found useful is Barcode Scanner.
The script generates a printable pdf that looks like the following:
A way to make this more convenient is to use a QR Code, which can be scanned to make a device connect to your wireless lan automatically. This actually works for many mobile devices, especially Android smartphones.
A simple Python script that can be used to create such a QR code can be downloaded here. It requires qrencode and Imagemagick. An Android QR code reader, which I have found useful is Barcode Scanner.
The script generates a printable pdf that looks like the following:
2015-07-10
Find the shortest path to lift-off!
Can you solve the riddle (pdf version here). The sha256sum of the solution is 38700dfad5711976e2f7aeab31013f04aed8c83118a1ef892f6d23bdfe94460. Good Luck!
2015-05-29
Legible Plots with Matplotlib and LibreOffice
Have you ever struggled presenting scientific plots in LibreOffice? A lot of the time the fonts come out too small or it can happen that thin lines disappear in scaled figures. Often plots are not originally created to be shown on slides. A pragmatic solution to create more legible plots with Matplotlib for LibreOffice slides is to take the dimensions that a plot should have on the final slide into account when creating the plot.
LibreOffice offers 12 standard layouts, as can be seen below:
Not all of these layouts are suitable to present plots, but for those who are, the dimensions of the layout boxes should be taken into account to create legible plots. E.g. in Matplotlib this can be accomplished with the following command:
matplotlib.rc('figure', figsize= [width,height])
Moreover, it is advantageous to modify some other style options to make a plot more legible. Some style options which I found helpful in the past are the following:
matplotlib.rc('lines', linewidth=4.0) #thick lines
matplotlib.rc('font', size=18) #big font
matplotlib.rcParams.update({'font.sans-serif': 'Liberation Sans'}) #adjust font w/ slide font
In my opinion .png is one of the few trustworthy output formats for plots. Generally producing plots in vector formats (e.g. .svg) would be nicer, but at least I have experienced these being rendered incorrectly (LibreOffice 4.3.6.2 was used at the time of this writing).
An example slide with these style options applied is shown below:
The full script that was used to create the sample plots can be downloaded here. It can also be used to create sample plots for the other LibreOffice layouts.
LibreOffice offers 12 standard layouts, as can be seen below:
Not all of these layouts are suitable to present plots, but for those who are, the dimensions of the layout boxes should be taken into account to create legible plots. E.g. in Matplotlib this can be accomplished with the following command:
matplotlib.rc('figure', figsize= [width,height])
Moreover, it is advantageous to modify some other style options to make a plot more legible. Some style options which I found helpful in the past are the following:
matplotlib.rc('lines', linewidth=4.0) #thick lines
matplotlib.rc('font', size=18) #big font
matplotlib.rcParams.update({'font.sans-serif': 'Liberation Sans'}) #adjust font w/ slide font
In my opinion .png is one of the few trustworthy output formats for plots. Generally producing plots in vector formats (e.g. .svg) would be nicer, but at least I have experienced these being rendered incorrectly (LibreOffice 4.3.6.2 was used at the time of this writing).
An example slide with these style options applied is shown below:
2015-05-04
Medisana ViFit connect Review
In the post I want to share some experiences with the Medisana ViFit connect, which is an activity tracker. It counts steps and bins them in intervals of 15min. Memory of the device is sufficient for 15 days of recording and battery lifetime is around 6 days. It has an OLED display that saves you from having to wear an additional wrist watch.
Medisana outlines that for optimal usage the activity tracker should be wrist worn. I disagree with this as my intuition is that the activity tracker overestimates the number of steps when wrist worn, especially when you spend a big portion of the day sitting.
Bluetooth 4.0 is used to upload recorded data to a smartphone, tablet, etc.. The synchronization is slow and not always successful. The app does not build an offline database, so internet connection is required while synchronizing. Moreover, synchronization always has to be explicitly initiated and is not executed as a background service.
The activity tracker has a Micro USB port for recharging. Interestingly, hooking it up to a Linux PC loaded a driver for this USB to UART bridge. Maybe this leaves some potential for hacking? It would be great to be able to download the activity data without having to upload them to the cloud first. Another idea would be to reduce the binning interval of the activity tracker to eg. 1min to be able to draw conclusions about the types of activity (eg. running, biking, hiking, sitting, etc.) from the recorded data.
In my opinion the accompanying website cloud.vitadock.com fails to provide much insightful information (Maybe there is a legal requirement that prevents them from interpreting the activity data for the user?). It is possible to export the activity data as .csv files and I find it helpful to create two additional plots as follows:
Firstly, a histogram showing the averaged activity for all days that usually falls within the individual times of the day. An exemplary plot is shown in Fig. 1 based on mock data. It is also interesting to compare working days and weekend days in this plot.
Secondly, a scatter plot showing the correlation between sleep time and the active time during the next day as shown in Fig. 2. Again this plot is based on mock data.
Medisana outlines that for optimal usage the activity tracker should be wrist worn. I disagree with this as my intuition is that the activity tracker overestimates the number of steps when wrist worn, especially when you spend a big portion of the day sitting.
Bluetooth 4.0 is used to upload recorded data to a smartphone, tablet, etc.. The synchronization is slow and not always successful. The app does not build an offline database, so internet connection is required while synchronizing. Moreover, synchronization always has to be explicitly initiated and is not executed as a background service.
The activity tracker has a Micro USB port for recharging. Interestingly, hooking it up to a Linux PC loaded a driver for this USB to UART bridge. Maybe this leaves some potential for hacking? It would be great to be able to download the activity data without having to upload them to the cloud first. Another idea would be to reduce the binning interval of the activity tracker to eg. 1min to be able to draw conclusions about the types of activity (eg. running, biking, hiking, sitting, etc.) from the recorded data.
In my opinion the accompanying website cloud.vitadock.com fails to provide much insightful information (Maybe there is a legal requirement that prevents them from interpreting the activity data for the user?). It is possible to export the activity data as .csv files and I find it helpful to create two additional plots as follows:
Firstly, a histogram showing the averaged activity for all days that usually falls within the individual times of the day. An exemplary plot is shown in Fig. 1 based on mock data. It is also interesting to compare working days and weekend days in this plot.
![]() |
Fig. 1.: Relative activity over time of the day |
![]() |
Fig. 2.: Active time versus sleep time |
2015-02-23
Graphviz Diagrams
The following images show regular 5x5 grids with a nearest neighbor, ring or complete topology:
I recently found out that drawing these kind of images is easily possible using Graphviz and Python. A small script that automates creation of these images with arbitrary number of rows and columns can be downloaded here. The script creates a .svg file, which can be conveniently postprocessed with Inkscape. Usage of the script is as follows:
python ./graphviz_grid.py <num_rows> <num_cols> <ring|nn|compl> <outfilename.svg>
I recently found out that drawing these kind of images is easily possible using Graphviz and Python. A small script that automates creation of these images with arbitrary number of rows and columns can be downloaded here. The script creates a .svg file, which can be conveniently postprocessed with Inkscape. Usage of the script is as follows:
python ./graphviz_grid.py <num_rows> <num_cols> <ring|nn|compl> <outfilename.svg>
2015-02-03
Measure your fame!
It recently occurred to me that Google Plus shows the amount of accesses on every G+ profile. Greatly amazed that Google Plus facilitates so much narcissism, I wanted to track the amount of accesses to my profile over time.
Here are two small and very simple scripts that can be used to record and visualize the amount of accesses for a G+ profile.
g+.py downloads the current amount of accesses from a G+ profile page. I recommend making a cron job that executes it daily. It is also possible to track other people's 'fame', since the amount of accesses of a G+ profile is public.
g+viz.py simply visualizes the recorded amount of accesses over time. The practical value of these plots is that they can be used to estimate how much resonance is created by the activity on a given profile.
Here are two small and very simple scripts that can be used to record and visualize the amount of accesses for a G+ profile.
g+.py downloads the current amount of accesses from a G+ profile page. I recommend making a cron job that executes it daily. It is also possible to track other people's 'fame', since the amount of accesses of a G+ profile is public.
g+viz.py simply visualizes the recorded amount of accesses over time. The practical value of these plots is that they can be used to estimate how much resonance is created by the activity on a given profile.
Subscribe to:
Posts (Atom)