Apr 20, 2024
· 2 minute read
·
Linux
My goal was to play audio over the network.
In detail, a computer with a sound card and speakers serves the audio device on
the network (referred to as server). Other computers (referred to as
clients) play audio which they send to the server to be played on the speakers
managed by the servers. Ideally, this happens in real time without delay.
NixOS setup
I had such a service set up using Pulseaudio a while ago, but it being
Pulseaudio I was eager to switch to Pipewire as soon as possible (Pipewire seems
to be the cool kid on the block). There are numerous sources available talking
about how easy a network setup was, however, I had trouble setting it up on
NixOS. So I thought sharing my configuration may be useful to others.
Read on …
Feb 14, 2024
· 3 minute read
·
Linux
For a long time I have been thinking about possible monitoring solutions for my
home server. To me, it was important that the solution
- has to be minimal and efficient;
- can be configured in a declarative way.
Also on my wishlist but not a necessity was a dashboard.
While thinking about this, I was coming back to an interesting NixOS Discourse
thread again and again. In particular, @ryantm was praising the minimalism of
Monit. The home page of M/Monit is promising but, meh, the tool is behind a
paywall.
Read on …
Dec 2, 2023
· 1 minute read
·
Coding
Alle Jahre wieder …
I am not sure how far I get this year, but writing Haskell is just too much fun.
Have a look at my solutions to the Advent of code, 2023.
Cheers!
PS: I even added automatic fetching of the full input as well as the samples
(see Fetch.hs). For example,
cabal run fetch 1 # Fetch full input of day one.
cabal run fetch 1 1 # Fetch sample one of day one.
Read on …
May 14, 2023
· 3 minute read
·
Linux
An update of my Tolino Shine 3 reader failed. The system recovery did not work
aborting with the following error:
Batterie fast leer! Ein-/Ausschalter druecken, Geraet mind. 2 h aufladen und neu starten.
Low battery! Press the power button, charge the device for a minimum of 2 hours and restart.
Weird. Charging did not help either. In fact, I am not not the only one
experiencing this problem. Be sure to read the linked blog post, it contains
important information. In particular, the battery check is flawed and the
Tolino Shine 3 system recovery is broken!
Read on …
Mar 2, 2023
· 3 minute read
·
Emacs
Do you want to use Emacs for Java development? I suggest using the language
server protocol with lsp-mode
and lsp-java
together with the Eclipse JDT
language server (jdtls
). And do you also want a declarative development
environment without surprises? Use Nix Direnv, envrc.el, and a Nix Flake! I
assume familiarity with these concepts. In the following, I will focus on the
Java-related Emacs setup.
The reason of this post is that I have stumbled upon problems when using a
declarative, project-specific configuration. In particular, lsp-java
uses a
global variable lsp-java-server-install-dir
which specifies the installation
directory of jdtls
. Further, it uses global workspace and configuration
directories which are jdtls
specific settings; we want those to be
project-specific.
Read on …
Dec 2, 2022
· 1 minute read
·
Coding
Everybody posts their solutions in Haskell to the Advent of code (described well
on Wikipedia). So I thought I am going to join the crowd.
Here are mine! I did clean the code after submission, but I did not change
anything substantial such as algorithms or data structures.
(Want some more? And — well — more?)
If you ask me, the solutions of Sheinxy and Scriptim are great! Also, do not
miss the ones posted by Monday Morning Haskell, although they do have some
boilerplate.
Read on …
Dec 2, 2022
· 1 minute read
·
Coding
<2023-02-27 Mon> Note: I have taken the application offline.
I created a minimalist weather predicition application — a short proof of
concept and stake.
The main elements of the Haskell tech stack are:
- Scotty: A web framework.
- Lucid: A domain specific language for HTML.
- Mcmc: A Markov chain Monte Carlo sampler.
Other noteworthy components of this project:
For details, have a look at the project source code.
Read on …
Jun 28, 2022
· 8 minute read
·
Coding
We analyze the number of worldwide airline fatal accidents:
Year |
1976 |
1977 |
1978 |
1979 |
1980 |
1981 |
1982 |
1983 |
1984 |
1985 |
Fatalities |
24 |
25 |
31 |
31 |
22 |
21 |
26 |
20 |
16 |
22 |
This table is an excerpt of Table 2.2 in Gelman, Andrew and Carlin, John B and Stern, Hal S and Rubin, Donald B (2014).
We assume that the number of fatal accidents \(X\) is Poisson distributed with
fatal accident rate \(\lambda\)
Read on …
Dec 18, 2020
· 5 minute read
·
Coding
I started this encyclopedic overview because in the Markov chain Monte Carlo
(MCMC) community many people call the same or similar concepts by very different
names. Please let me know, if you have suggestions or comments, or if you would
like to add some definitions or synonyms to this overview.
Bibliography
Books
- The nomenclature here is taken from the excellent introduction to Markov chain
Monte Carlo (MCMC) methods by Geyer, Charles J (2011), Chapter 1 in
Brooks, Steve and Gelman, Andrew and Jones, Galin and Meng, Xiao-Li (2011).
- More advanced topics such as population based MCMC methods are covered in
Liang, Faming and Liu, Chuanhai and Carroll, Raymond (2011).
- See Arnaud Doucet and Nando de Freitas and Neil Gordon (2001) for sequential Monte Carlo algorithms.
Articles
- Walter R. Gilks and Carlo Berzuini (2001)
- Del Moral, Pierre and Doucet, Arnaud and Jasra, Ajay (2006)
- Andrieu, Christophe and Doucet, Arnaud and Holenstein, Roman (2010)
- A. {Doucet} and A. M. {Johansen} (2011)
- Chopin, N. and Jacob, P. E. and Papaspiliopoulos, O. (2012)
- Heng, Jeremy and Bishop, Adrian N. and Deligiannidis, George and Doucet, Arnaud (2020)
Articles tailored to a phylogenetic audience
- Bouchard-Côté, Alexandre and Sankararaman, Sriram and Jordan, Michael I. (2012)
- Vu Dinh and Aaron E Darling and Frederick A Matsen IV (2018)
- Mathieu Fourment and Brian C. Claywell and Vu Dinh and Connor McCoy and Frederick A. Matsen IV and Aaron E. Darling (2018)
Necessary definitions
Elementary updates are instructions about how to advance a Markov chain so
that it possibly reaches a new state. That is, elementary updates specify how
the chain traverses the state space. Elementary updates cannot be decomposed
into smaller updates.
Read on …
Nov 21, 2019
· 4 minute read
·
Coding
The Algebraic Graphs Haskell library (Alga) is a fast, minimalist, and elegant
approach to working with graphs that allows for equational reasoning about the
correctness of algorithms. For reference, please also see the accompanying
paper.
The advantages are:
- algebraic graphs have a small core with just four graph construction primitives;
- the core has a mathematical structure characterized by a set of laws or
properties.
A directed graph in the mathematical sense is a set \(V\) of vertices \(v_i\)
together with a set \(E\) of directed edges \((v_i, v_j)\), and is denoted
\((V,E)\). The beauty about algebraic graphs is that they are not defined
explicitly by lists of vertices and edges but in a recursive manner, similar to
the definition of algebraic trees.
Read on …
Feb 10, 2018
· 4 minute read
·
Coding
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). Furthermore, I looked through a lengthy post about using
Markov chains to simulate interaction of magnetic spins using the Ising model.
The concept of a Markov chain is explained well in this article but I believe
that the example is too complicated to understand in a reasonable amount of
time. Also, the Repa package is used to represent the transition matrices. This
seemed a little bit of an overkill to me, so I decided to go with maps.
Read on …
Sep 13, 2017
· 1 minute read
·
Linux
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 …
Sep 5, 2017
· 2 minute read
·
Linux
[2019-03-01 Fri] See comment below; some Linux operating systems already provide
native support for the Marvell RAID controller in legacy mode.
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).
Read on …
Jul 20, 2017
· 3 minute read
·
Coding
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.
And here the definition of foldlM
(which is the same as foldM
).
Read on …
Aug 5, 2016
· 3 minute read
·
Linux
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 …
May 20, 2016
· 1 minute read
·
Linux
Autojump is a cd
command that learns! It enables you to easily
navigate directories from the command line:
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 …
Apr 9, 2016
· 1 minute read
·
Coding
[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., Schrempf,
D., & Kosiol, C. (2015). PoMo: An Allele Frequency-Based Approach for
Species Tree Estimation. Systematic Biology, 64(6),
1018–1031. https://doi.org/10.1093/sysbio/syv048).
Read on …
Apr 9, 2016
· 2 minute read
·
Linux
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.
ssh-keygen
# Copy the key on your server.
ssh-copy-id yourusername@yourserver.example.com
# Try it out and be happy!
ssh yourusername@yourserver.example.com
Use ~/.ssh/config
Now, it is getting better; edit or create the file ~/.ssh.config
:
Read on …
Aug 31, 2015
· 1 minute read
·
Music
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 …
Jun 24, 2015
· 3 minute read
·
Emacs
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. It can
Read on …
Apr 25, 2015
· 2 minute read
·
Linux
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.g., by
time and date) or to change Exif flags.
Read on …
Apr 22, 2015
· 5 minute read
·
Linux
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 …
Apr 4, 2015
· 2 minute read
·
Emacs
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:
I can recommend to use the TAB
key for completion and not for other
actions. You can bind the TAB
key back to
helm-execute-persistent-action
with
Read on …
Mar 26, 2015
· 1 minute read
·
Coding
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.cpp
- Simulation of a Markov chain that moves around the
eight vertices of a cube
ehrenfest_mcmc.cpp
- Simulate gas particles in a divided box
general_discrete_distributions.cpp
- Given K discrete events with
different probabilities P[k], produce a random value k consistent
with its probability
general_discrete_markov_chain.cpp
- Simulate a general discrete
Markov chain with a given transition probability matrix P
genetic_drift.cpp
- Simulate genetic drift
hitchhiking.c
- Simulate hitchhiking along a positively selected locus
stepping_stone_model.cpp
- Simulate Stepping Stone Model with a
Markov chain
Please check out the detailed documentation on the github repository.
Read on …
Jan 30, 2015
· 4 minute read
·
Linux
<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 …
Jan 15, 2015
· 4 minute read
·
Coding
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.e., the probability that
\(\theta\) is a certain value conditioned on our observation).
Read on …
Jan 7, 2015
· 1 minute read
·
Linux
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 …
Jan 7, 2015
· 1 minute read
·
Linux
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:
- Use GNU Parallel to zip them:
parallel -a folders "tar -czf {}.tar.gz {}"
In order to unzip many files at ones (this method can also be used to
zip the files if their names follow certain patterns):
Read on …
Dec 26, 2014
· 4 minute read
·
Emacs
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. One of this formats is HTML. The idea
here is to use the publishing capabilities of Org mode to create
a very basic website that can be used to blog and publish
articles.
- GitHub
- Offers a freely available hosting service, a very easy way
to make the website available.
- Disqus
- Provides the ability to comment posts.
Many people also use Jekyll to create homepages and blogs together
with Org mode and GitHub. This is certainly a very appealing
alternative but I prefer a setting that is easier to set up and has
fewer options.
Read on …
Dec 23, 2014
· 1 minute read
·
Coding
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.ppShow object
Read on …