# Git: managing a website using hooks

link Git is a very powerful tool when coding. It has bothered me for a while now that I didn’t know how to use it to push changes to a website server. Finally I decided to do some digging and figured it out. In order to avoid having the actual repository in the website’s directory

# C++: the Named Parameter Idiom

Some times you will have a large C++ class with many parameters that need initializing. That can lead to some ugly constructor calls: auto popsim = PopulationSim(1000, 100000, 1000, 1000, 1500, 0.17, 0.05, 32, 3, 1, 7, 1); This makes the code very hard to maintain and debug, as there is no easy way to

# Lecture summary: Programming Techniques for Scientific Simulations

During the autumn semester of 2017 I took the course “Programming Techniques for Scientific Simulations” as part of my BSc course in Computational Science and engineering at ETH Zürich. This is a summary of the course’s contents I wrote and used during the actual exam. Some things are missing, as it was an open-book exam

# Setting up a Raspberry Pi as a Git server

I was looking for a way to set up a private git server that I could access from anywhere, to synchronize my work across several computers. I remembered I had a Raspberry Pi lying around that wasn’t getting any real use, so I figured this would be a perfect use case! My first idea was

# Setting up passwordless SSH access on Linux

SSH stands for Secure Shell Host. It effectively allows you to access the terminal (shell) on a remote machine – securely. There are two ways to validate your identity when attempting to access a server via SSH: password, or SSH key pair. Password authentication is the default method: you run a command similar to ssh

# Introduction to plotting with Python and Matplotlib

Here is a brief example of how to plot data with Python and, specifically, the matplotlib library. The following program calculates an estimate of Pi by generating random points in the range [-1;1) x [-1;1), and using the ratio between the number of points inside the unit circle to the total number of points. There

# Accelerating build processes with multithreading

Building (compiling) large projects can take a long time. Build systems like Make and SCons do a really good job of reusing resources that don’t need recompiling because we didn’t change anything, but compiling a large project for the first time can still take a while. One solution to this issue, especially with multicore and

# gnuplot revisited

Here is a more sophisticated example of using gnuplot: set terminal png size 1920, 1080 enhanced font ‘Verdana,15’ # Different log scales set logscale x 2 set logscale y 10 # %L is the exponent of the current log scale set format y “%g” set format x “2e%L” # Move the legend to the top

# Cmake basics

We already know make, a powerful tool to automate all kinds of building sequences. But if you are using it to compile large C++ projects, you will quickly find that it’s tedious to maintain, and that you’re often repeating the same commands over and over again. This, of course, opens up the door to mistakes

# A simple gnuplot example

gnuplot is a very easy-to-use tool allowing us to quickly plot data we generated with, for instance, a C++ program. Here is a sample gnuplot script – see a brief explanation of the commands below: set terminal png size 900,675 enhanced font ‘Verdana,9’; set output ‘error_plot.png’; set logscale xy; show logscale; set format xy “%g”;