A minimal echo service in Go

Something that comes up often in the context of testing is the need for a simple service that exposes an HTTP API. The simplest non-static service I can think of is something that replies with the same input that I provide it with. So, let’s have a look at a service written in Go that echos the input provided by a query parameter: package main import ( "fmt" "log" "net/http" ) func handlePing(w http.ResponseWriter, r *http.Request) { input := r.URL.Query().Get("this") fmt.

My tmux setup

Are you using tmux? If not, why not? Let me debunk some myths and misconceptions in this post and share my tmux setup with you in the hope to convince you to start using it as well. I don’t know about you, but I do spend a fair amount of my day in the terminal. Usually, I’ve got a number of projects open I’m working on, each with its setup such as current directory, environment variables, and so forth: I first came across screen and wasn’t sold.

Slice N Dice

Today we will have a closer look as to what data manipulation, transformation, cleaning, and querying can be done, out-of-the-box, on the command line. Most of the tools discussed here, such as tr or awk have been around for, like, ever. Others, for example jq, might be younger but given the omnipresence of JSON-based payloads I’d argue it is indispensible. Oftentimes it makes much more sense to use jq to pull out a deeply-nested value rather than grep-ing or awk-ing it—less brittle and easier to understand, that is, to maintain.

Some basic shell tips

In the following we will walk through some random (Bash) shell tips. Think of it as a 101 of shell interactions; some might be useful refreshers others may in fact be new to you— they certainly have been to me, despite using Bash for some 20 years. File descriptors: stdin, stdout, stderr So, the Bash shell has three default file descriptors (FD) for each process: 0 aka stdin 1 aka stdout 2 aka stderr Assuming the terminal is /dev/tty0 then all three point to it on process launch and here’s what you can with those FDs, for example:

Yet another coding blog?

So, yet another coding blog? Yeah, a couple of things coming together: in March 2019 I joined AWS as a developer advocate for containers with a special focus on security. I have been and continue to develop tooling, mainly using Go and shell scripts. In addition, I finally wanted to start sharing stuff I’ve been collecting over the past 10+ years in various (private) repos and gists, mainly code snippets or commands that make my life easier—since they helped me, why would they not be useful for others?