Quick Mock Server

Are you in a need of a quick mock server? One simple solution for Linux/Mac/BSD users is to employ an existing tool, nc. It exists in most distros and it’s very easy to use. #!/bin/bash if [ "$#" -ne "1" ]; then echo "usage: ./mock_server.sh <port>" exit 1 fi trap "{ exit 0; }" SIGINT SIGTERM SIGKILL PORT="$1" function make_response() { read -r response echo -e "HTTP/1.1 200 OK\r\n\r\n${response}" } while true ; do dd if=/dev/zero count=10000 make_response | nc -l "$PORT" done Save this in a file called mock_server.

Favourite VSCode Extensions

I’ve been using VSCode for about 3 years now, it’s not the best editor out there, but I like it. I try to keep it minimal with only a few extensions for executing certain things quickly and easily. Here’s a list of the extensions I use: C# - I’ve been writing C# over 5 years now, the first years I used Visual Studio, then vscode came out and I switched.

Learning a Musical Instrument

About 2 years ago I decided to learn a musical instrument. I have always been interested in string based instruments so I decided to learn how to play guitar. First, I tried out a friend’s guitar and then I realized that I really liked it, so I bought a cheap acoustic guitar. My knowledge about playinng musical instruments was very limited, I knew very basic things from school most of which have faded over time.

Editors Choice

I’ve used a few editors over time, Emacs, Atom, Sublime, Vim, VSCode, IntelliJ, Visual Studio and Xcode. From those I’ve used professionally Xcode, Emacs, Visual Studio, vim, vscode and Intellij. I have tried to use atom and sublime, but they never really stack. Here is a small review of what I like and what I don’t for each one of them. FYI my favourite 2 are vim and vscode. Atom didn’t really click for me, I’ve met people that liked it, but I never managed to like it.

Go Patterns?

I came across a repository on github that consolidated simple examples exhibiting design patterns in Go. In the beginning I thought that was a great resource, but after a while I got a bit confused. You will find a list of patterns like creational, structural, behavioural, synchronization, concurrency, messaging, stability, profiling, idioms and anti-patterns. You find patterns like Abstract Factory, Singleton, Bridge, Decorator, Mutex, Semaphore, Coroutines, and many more. My favourites are synchronization and concurrency.

One Use Case for TPL

TPL is a set of libraries from Microsoft that can be used for parallel processing, basically it is a set of high level tools that can make your code run in parallel. TPL is not a panacea for parallel processing, mainly because you don’t always need parallel processing, but when you need it, it can be a life-saver. The system The system was built with a simple purpose, to consume and process events delivered by Kafka.

Multi-stage building with Docker

Docker supports a feature, where you can create multiple containers with a single dockerfile and at the same time share the contents between the containers. This feature gives you the possibility of having multi-stage builds and opens one significant spot for creating repeatable builds. The idea behind it is simple, you can have multiple FROM statements inside the same Dockerfile. Each FROM statement can use different images, therefore defines it’s own dependencies and allows you to connect the containers from one base to the other by using COPY --from=0or COPY --from=previous-stage.