Notes about open source software, computers, other stuff.

# Tag: GNU

It was quite a long time in the making and then a bunch of other stuff came in between, but I finally managed to release v0.4.4 of ProbABEL!

ProbABEL is a toolset for doing fast, memory (RAM) efficient genome-wide regression tests.

This is a bugfix release, but a major one for those who use the Cox proportional hazards regression module. Thanks to some of our users on the GenABEL forum, a serious bug leading to way to many NaN’s in the output was discovered, fixed and tested. This is one of the best examples of community collaboration I have seen in the GenABEL project.

Another bug fixed in this release is one that caused a failed install on MacOS X and FreeBSD. Again a bug reported on the forum by one of our users. Great work!

Uploads to Debian and the Ubuntu PPA are coming ASAP.

Now, let’s get ready for a new feature release, which will include p-value calculation (a long-standing feature request) and major speed-ups (implemented by former colleague Maarten Kooyman). Time to get to work ;-)!

Some time ago I moved from using LVM to using ZFS on my home server. This meant I also had to change the backup script I used to make backups on a remote Synology Diskstation. Below is the updated script. I also updated it such that it now needs a single command line argument: the hostname of the Diskstation to backup to (because I now have two Diskstations at different locations). If you want to run this script from cron you should set up key-based SSH login (see also here and here).

#!/bin/bash # # This script makes a backup of my home dirs to a Synology DiskStation at # another location. I use ZFS for my /home, so I make a snapshot first and # backup from there. # # This script requires that the first command line argument is the # host name of the remote backup server (the Synology NAS). It also # assumes that the location of the backups is the same on each # remote backup server. # # Time-stamp: <2014-10-27 11:35:39 (L.C. Karssen)> # This script it licensed under the GNU GPLv3.   set -u   if [ ${#} -lt 1 ]; then echo -n "ERROR: Please specify a host name as first command" 1>&2 echo " line option" 1>&2 exit -1 fi ############################### # Some settings ############################### # Options for the remote (Synology) backup destination DESTHOST=$1 DESTUSER=root DESTPATH=/volume1/Backups/ DEST=${DESTUSER}@${DESTHOST}:${DESTPATH} # Options for the client (the data to be backed up) # ZFS options ZFS_POOL=storage ZFS_DATASET=home ZFS_SNAPSHOT=rsync_snapshot SNAPDIR="/home/.zfs/snapshot/$ZFS_SNAPSHOT"   # Backup source path. Don't forget to have trailing / otherwise # rsync's --delete option won't work SRC=${SNAPDIR}/ # rsync options OPTIONS="--delete -azvhHSP --numeric-ids --stats" OPTIONS="$OPTIONS --timeout=60 --delete-excluded" OPTIONS="$OPTIONS --skip-compress=gz/jpg/mp[34]/7z/bz2/ace/avi/deb/gpg/iso/jpeg/lz/lzma/lzo/mov/ogg/png/rar/CR2/JPG/MOV" EXCLUSIONS="--exclude lost+found --exclude .thumbnails --exclude .gvfs" EXCLUSIONS="$EXCLUSIONS --exclude .cache --exclude Cache" EXCLUSIONS="$EXCLUSIONS --exclude .local/share/Trash" EXCLUSIONS="$EXCLUSIONS --exclude home/lennart/tmp/Downloads/*.iso" EXCLUSIONS="$EXCLUSIONS --exclude home/lennart/.recycle" EXCLUSIONS="$EXCLUSIONS --exclude _dev_dvb_adapter0_Philips_TDA10023_DVB*"       ############################### # The real work ###############################   # Create the ZFS snapshot if [ -d $SNAPDIR ]; then # If the directory exists, another backup process may be running echo "Directory$SNAPDIR already exists! Is another backup still running?" exit -1 else # Let's make snapshots zfs snapshot $ZFS_POOL/$ZFS_DATASET@$ZFS_SNAPSHOT fi # Do the actual backup rsync -e 'ssh'$OPTIONS $EXCLUSIONS$SRC $DEST # Remove the ZFS snapshot if [ -d$SNAPDIR ]; then zfs destroy $ZFS_POOL/$ZFS_DATASET@$ZFS_SNAPSHOT else echo "$SNAPDIR does not exist!" 1>&2 exit 2 fi   exit 0

Today I was working on an Emacs org-mode document that I wanted to export to PDF. The document contained several tables and for the PDF export I wanted to hide one of the columns in the table. Of course I could have removed the column in the org source, but since I might need it in the future that wasn’t really an option.

Searching the internet I came across this e-mail discussion on the org-mode mailing list, where radio tables were suggested. I briefly tried to get that working, but it seems that this is more of an option if you are working in e.g. a LaTeX document and want to use org-style formatted tables.

So I tried another search, this time on how to hide columns in LaTeX, having the idea in mind that I could then use that to fix the org-mode export. Thanks to question on tex.stackexchange.com I came up with the followin solution:

First add the following lines at the top of the org file, after the regular org-mode header (if you have one):

#+LATEX_HEADER: \usepackage{array} #+LATEX_HEADER: \newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}}

This defines a new column type with the name H (for ‘hidden’). Next, just before the table, simply add an #+ATTR_LATEX: attribute (see the org-mode manual):

#+ATTR_LATEX: :align lHl | col 1 | to be hidden | col3 | |-------+--------------+--------| | 1 | secret | info 1 | | 2 | private | info 2 | | 3 | hidden | info 3 |

When you export this to PDF (via C-c C-e lo) the table in the PDF only contains the first and last column.

If you’re interested in a short (14 minute) talk on what Free Foftware is all about, have a look at Richard Stallman’s TEDx Geneva presentation. It’s an excellent introduction by the master himself!

Note: the video above is only half the size of the original because I wanted it to fit the width of this blog.

After starting Emacs you end up in the *scratch* buffer (assuming you’ve disabled the startup message in your .emacs file). The *scratch* can be used for writing down notes and some Lisp experiments (since it uses the Emacs Lisp major mode by default).

Now, I’m not very much of a Lisp programmer, but I do use Org-mode a lot. Consequently, I found myself changing the buffer’s major mode to org-mode regularly. And Emacs wouldn’t be Emacs if you couldn’t change this to a default. So, thanks to Bozhidar Batsov over at Emacs Redux, I’ve added the following lines to my Emacs configuration file:

;; Set the default mode of the scratch buffer to Org (setq initial-major-mode 'org-mode) ;; and change the message accordingly (setq initial-scratch-message "\ # This buffer is for notes you don't want to save. You can use # org-mode markup (and all Org's goodness) to organise the notes. # If you want to create a file, visit that file with C-x C-f, # then enter the text in that file's own buffer.   ")

Recently I added the following lines to my ~/.emacs file:

;; Don't insert tabs when indenting regions (setq-default indent-tabs-mode nil)

The idea behind disabling the indent-tabs-mode was that (especially) while programming I want any tabs to be converted to spaces. Since different people have different settings for a tab width this seemed like a good choice.
However, once I opened a Makefile I ran into trouble. In a Makefile tabs are a requirement, not an option. Since all my tabs were converted to spaces the moment I saved a Makefile compiling became a nightmare. To solve this problem I added the following to my ~/.emacs file, after the aforementioned statement:

(add-hook 'makefile-mode-hook (lambda () indent-tabs-mode t))

This enables tabs again for modes that involve Makefiles.

I’m an avid user of Emacs and have been using org-mode for a couple of years now to write notes, keep a ToDo list and a few other things.

A couple of days ago I came across an article in the Journal of Statistical Software that describes how to use org-mode for reproducible research. It’s a great read and the source code of the complete article can be downloaded as well!

I learned something new in Emacs (my favourite text editor) today. Normally in Emacs, if you start typing while having some text selected will not overwrite this text. This is contrary to what most people are used to in other editors. It turns out that Emacs has a minor mode that fixes this: delete-selection-mode. Add the following to your .emacs file to have it loaded by default:

(delete-selection-mode t)

Since delete-selection-mode enables transient-mark-mode I commented the line

(setq transient-mark-mode t)

in my .emacs

References: