Supervised Caddy

Caddy, the HTTP/2 web server with automatic HTTPS, is easy to configure and use. The release package contains information about executing Caddy as a service, e.g. with Systemd or Upstart.

This post shows a configuration using Supervisor a process control and monitoring system. Benefits are: reboot safe execution, automatic restart after crashes and execution as a non-root user.

Login/logout in web application (Go)

Goal: simple example for session management using secure cookies.

Serve two pages - an index page providing a login form and an internal page that is only accessible to authenticated users (= users that have used the login form). The internal page provides a possibility to log out.

This has to be implemented using only the Golang standard packages and the Gorilla toolkit.

The following sections describe a possible implementation (~ 120 lines of code). The full code can be found here.

Useful Sublime Text 3 packages

Everyone seems to publish a list of his or her favorite Sublime Text packages. This is my list and if you do not use Sublime Text, you should.

Determining instruction coverage using Pin

Pin is an extendable tool for the dynamic instrumentation of programs. It supports many execution platforms and allows the injection of instrumentation code at arbitrary locations in an executable at runtime.

I created a Pin extension tool to determine coverage information of instrumented programs. The tool is open source and can be found on Github.

Analyzing guess (aka. Mastermind)

Guess is a simple code-breaking game where the player tries to determine a secret color combination. The player guesses a sequence of colors and gets two pieces of information back: (1) how many colors are correct and in the correct position, and (2) how many colors are correct but in the wrong position. With this information the player guesses again until the secret code is revealed.

In the standard game, the color code contains four places - each place can be assigned with one of six possible colors.

Following are a few Python methods to analyze the game.