Markov chains in Haskell

I have been working on Markov chains for quite a while now and wanted to assess how Haskell can deal with simulating a simple, discrete chain. Many sources can be found online. The code presented here is partly taken from a question on stackoverflow. However, I was unsatisfied with the nomenclature and parts of the code. So I refactored most of it. Also, there is a Haskell library markov-chain, which I am unsatisfied with because of code readability (it’s pretty abstruse).  Read on →

Networking HOWTOs

Sometimes you discover online resources that you want to remember and share. These tutorials by the developers of iptables (mainly Paul ‘Rusty’ Russell) are one of those gems. They discuss how the internet works, how packets can be adequately filtered and how a firewall can be setup. Enjoy!  Read on →

Marvell Storage Utility on HPE ProLiant MicroServer Gen10

Marvell SATA controller Recently I purchased an HPE ProLiant MicroServer Gen10 which comes with the Marvell SATA controller 88SE9230, also called Marvell Storage Utility (MSU). As far as I know, this controller has an ARM chip to provide RAID 0 (non-redundant combination of disks), RAID 1 (straight mirroring) or RAID 10 (a combination of RAID 0 and RAID 1). Neither Marvell nor HPE do provide drivers for generic Linux systems but they do provide a package for ClearOS which uses the Red Hat Package Manager (RPM).  Read on →

Happy folding around monads in Haskell

Folds are complicated themselves, but monadic folds always have blown my mind. In what follows, I try to dissect foldlM for a specific example. Monadic folds can be used to perform a series of actions that depend on the previous output. The following function produces an action b from a value a also taking into account the output of the previous action b. f :: (b -> a -> m b) And here the definition of foldlM (which is the same as foldM).  Read on →

Get rid of Google

I like a lot of stuff that Google is doing, especially that it supports open source. However, I really dislike their attitude towards user privacy. That is why I decided to get rid of Google on my Android phone. However, I had to solve some problems in order to keep user-friendliness at a high level and to be able to use all applications that I need. The main issues are:  Read on →

Autojump

Autojump is a cd command that learns! It enables you to easily navigate directories from the command line: Autojump on GitHub It is readily available in most Linux distributions. The sole thing that has to be done manually is sourcing a script in your .bashrc. source /etc/profile.d/autojump.sh Jumping around with j is awesome :-)!  Read on →

A simulator for continuous-time Markov chains

[2016-04-09 Sat] I extended my set of C++ programs to include a simulator for generic continuous-time Markov chains. I.e., any transition rate matrix can be used. If you are interested, just get the GitHub repository and compile the whole set of programs with make all. Documentation can be found in the doc/ folder (check the CTMC class). There is a sample program src/moran_model_boundary_mutation, that runs the Moran model with boundary mutation (De Maio, N.  Read on →

Configure SSH

Did you ever get sick of typing the IP of your SSH server. There is an incredible feature of SSH that saves you a lot of time typing host names, IP addresses or passwords. Login with SSH key First, you want to create your own SSH key so that your server accepts your login without any password. # Create an SSH key (use the standard path). Be careful, if you do # not set a passphrase, anybody that has access to your computer can # log into servers that have been set up to accept your key.  Read on →

Cantus Novus Wien

In my free time I love to make music and that’s why I am participating in the choir Cantus Novus Wien. We are about 40 people and perform sacred as well as secular music pieces. Audio samples Audio samples can be found on Soundcloud. A short quote from the homepage (in German) Der Cantus Novus Wien besteht aus engagierten Sängerinnen und Sängern, die am Wiener Diözesankonservatorium für Kirchenmusik zusammenfinden. Das gemeinsame, lebendige Singen zielt auf hohe musikalische Qualität; ein Schwerpunkt ist dabei zeitgenössische Chormusik mit Uraufführungen von Auftragswerken österreichischer Komponisten wie Wolfgang Sauseng, Ruth McGuire, Wolfgang Reisinger, Markus Pfandler und Wolfram Wagner.  Read on →

Debugging with Emacs and GDB

Introduction Erroneous source code can be a nasty issue to tackle. Print statements that inform you about the states of variables are handy but sometimes they are unable to represent the intrinsic structure of the code. Debuggers allow you to run your code step by step, display and watch variables and see what is going on inside another program while it executes. The GNU poject debugger Here, we will use the GNU project debugger (GDB), because it is freely available, very actively developed and can be used on many operating systems.  Read on →

exiv2 command line power

Does this sound familiar to you: You come back from a holiday with your family or friends and want to merge photos taken with 4 different cameras. However, somebody forgot to adjust the date (or did not set the daylight saving time accordingly). Hmm. This problem can be solved easily. exiv2 is a program to read and write Exif image metadata and image comments. It offers a very easy command line interface and shortcuts to batch rename files (e.  Read on →

Syncthing with SSH Port Forwarding

Introduction Recently, I have explained how to configure BitTorrent Sync over an SSH SOCKS proxy. However, due to various problems with BTSync, I tried Syncthing and I am very satisfied with it. Advantages that I have experienced so far: open source; publicly available synchronization protocol; very reliable if the configuration is fine; it’s a young project with motivated developers; it is fast (if enough CPU is available). Disadvantages that I have experienced so far:  Read on →

Emacs Helm and Hydra minor modes

Recently, I stumbled upon two nice Emacs minor modes. Helm mode Helm mode offers an incremental completion and selection narrowing framework. It will help you to find what you’re looking for in Emacs (like buffers, files, commands etc). Resources and discussions can be found at the following homepages: development and installation instructions at the Helm mode GitHub page; the Emacs initialization files and configuration of the Helm maintainer; a good overview of the features and a sample configuration.  Read on →

Population genetics C++ programs

I maintain a Github repository that contains a bunch of very basic C++ programs that use Markov chains and other types of simulations to infer basic statistical parameters. The applications mainly focus on Population Genetics problems, although this is not always the case. At the moment, the list of programs is: bookshelf.cpp Bookshelf Markov chain brownian_motion_mcmc.cpp Simulate standard Brownian motion (Wiener process) coin_toss_mcmc.cpp Run a coin toss MCMC simulation cube_mcmc.  Read on →

BitTorrent Sync over SSH proxy

<2015-04-22 Wed> I have switched from BitTorrent Sync to Syncthing. Reasons are: the synchronization was not reliable (synchronization stalled sometimes; every update leads to a re-synchronization of all files); the corporate policy is not to my liking (a Pro version is available; the free version only supports a limited amount of folders and clients; it is not sure if it will stay free in the future). Please also refer to the blog entry that describes how to configure Syncthing with SSH port forwarding.  Read on →

A simple MCMC simulation

Suppose we observe 58 heads out of 100 coin tosses. Now, we want to know the probability of tossing a head \(\theta\). A maximum likelihood guess would be \(\theta = 0.58\) because then, the probability of observing 58 heads \begin{align} P(58 \mathrm{ heads}) = {100 \choose 58} (0.58)^{58} (0.42)^{42} \end{align} is greatest (an example of the binomial distribution). However, we could also use a Bayesian approach to calculate the posterior distribution of the probability \(\theta\) (i.  Read on →

Dateutils

Did you ever need to calculate the time difference between two consecutive time stamps from a log file or something similar? Check out dateutils, it is really useful: ddiff -i '%H:%M:%S' '19:09:43,683' '19:34:10,350'  Read on →

Zip folders with GNU Parallel

Working with large files takes a long time. Sometimes, it is worth to zip folders individually, so that a single archive does not get too large. GNU Parallel is a shell tool to execute jobs in parallel. Here, I show one of possibly many methods to use it to zip many folders (or files) in parallel. Create a file with all folders that you want to zip, e.g with: ls -1 > folders Use GNU Parallel to zip them: parallel -a folders "tar -czf {}.  Read on →

How to create this homepage

This homepage was created with Emacs and Org mode. It is hosted at github.io and comments can be done using Disqus. I assume a working Org mode setup and a GitHub as well as a Disqus account. <2015-03-26 Thu> Update; general revision of code and text. <2016-04-09 Sat> Another update. General idea Org mode A great tool for taking notes and exporting them to all kind of formats.  Read on →

Easy pretty print in Haskell

I repeatedly struggle with GHCi when I want to print lists and maps and actually look at them and analyze them. Today I came accross pretty-show, a haskell package that allows pretty printing of all objects that are instances of the type class Show. The usage is very straight forward: import qualified Text.Show.Pretty as Pr This provides Pr.ppShow which can be used in GHCi (or other interpreters): putStrLn $ Pr.  Read on →