Homebrew Bundle with Ansible

Bundle is a tap (aka extension) to run several Homebrew commands in one go. The list of commands is read from a plain-text Brewfile. In contrast to Ansible’s Homebrew module with a manually maintained items list, a Brewfile can be created from the currently installed Homebrew packages, making it a better fit for some use cases. This article gives a short introduction to Homebrew Bundle and shows how to use it from Ansible.

WireMock with Groovier Syntax

WireMock is a library for stubbing and mocking web services. It makes heavy use of the builder pattern and has a very expressive syntax. But with Groovy’s operator overloading, it can be improved even further.

Local Logstash Testing

Logstash is famous for being the L in ELK. It is a log processing tool that tries to make sense out of mostly unstructured log messages by given parsing rules. This article descibes how I develop and test Logstash rules on my local machine, before applying them to production environment.

Spock: share common test setup with Traits

Common test data can be shared either by putting it into helper classes or in a common test base class. But there’s a third way. Spock has full support for Traits and this post will explain how to use it.

Groovier custom Hamcrest Matchers

Custom Hamcrest Matchers help quite a bit in simplifying unit tests and they are fairly easy to implement. The interface contains only 3 methods, 2 of them to create a textual description of expected and actual parameters and one do perform the verification. Implementing an interface is not difficult at all, but a lot of boilerplate code is required just to make that happen. I wanted to see how much this can be simplified using Groovy and the answer is quite a lot.

Enable live updates in Nginx Docker container

Running nginx from Docker is a piece of cake and hosting local files are equally easy. But there’s one catch if you’re using boot2docker, at least on a Mac: live updates are not working. Changes on local files are not reflected in nginx immediately, but a container restart is required. This post describes how to work around this limitation.

Project template: Gradle, Groovy, Spring 3, Hibernate 4, HSQLDB and Logback

To have a simple quickstart in future private projects, I created a small project template. With just 3 files, you get a Spring container with Hibernate connected to an in memory database and slf4j/logback for logging. Spring and Hibernate are configured to support annotations and you can overwrite setting by providing an optional property file. Gradle takes care of dependencies.

Access OSX key chain

At everyday scripting, you often need to access sensible information like passwords. A common practice is to just write them plain text into your script, but at least on a Mac, we can do better.

How to patch binary files with Java

Recently, I wanted to create an “intelligent” binary patcher, which not only replaces some chunk of binary data at a file’s predefined offset, but instead performs search and replace. Here is the Java class I came up with.

Robust HTML parsing the Groovy way

With Groovy, it’s very easy to parse XML data and extract arbitrary information. This works great as long as the input data is well-formed, but you can’t always guarantee that in real-world scenarios. Think of extracting data from HTML pages. They are very often a mess when it comes to XML validity and that’s where the TagSoup library comes to the rescue.