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).
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.
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.
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.
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:
The development environment is managed by the Nix package manager. The application is deployed using a Nix Flake.
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).
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)\).
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).
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.
f :: (b -> a -> m 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:
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 …
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.
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.
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.
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.
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:
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 …
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.
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.
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: ls -1 > folders Use GNU Parallel to zip them: parallel -a folders "tar -czf {}.
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.
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 …