Modifying an interface{}-ed struct in Go via reflection

14 September 2014

As interface{} is Go’s go-to tool when accepting unknown types in a function, sometimes we need to work on modify those types. One of the tasks that comes up fairly often is to modify a field in a structure that was passed into a function via interface{}-type parameter.

Let’s see how we can do it easily.

Go kata - generating random strings

10 August 2014

Let’s look at a small exercise to generate a large number of unique string codes. It turned out to be an interesting kata, with a number of unexpected discoveries made along the way.

I’ll also discuss a number of interesting points and tricks learned doing it.

HTTP request debugging in Go with httputil

29 July 2014

Many tools and libraries which deal with HTTP requests provide means to dump full request and response data for debug purposes. http package in Go, by itself, does not provide this capability – but it can be easily extended with httputil to do so.

Let’s see how both packages work together.

GZipped JSON files and Logstash

13 January 2014

Working on moving a large part of data from our database into the offline storage, I and my team have faced a problem of keeping it gzipped in the filesystem, but at the same time making it easy to send it for processing to Elastic Search. The obvious solution was to use Logstash as the middleman, but it doesn’t really handle archived data from the box.

Let’s see how we can write an input plugin for Logstash to make this process easy.

Automatic system backups with backup gem and some shell scripting - part 3, large file structures

12 January 2014

In part 1 and part 2 of this series we set up a remote image file as the backup storage, and learned how to use Backup gem to back up a database and small data directories.

In the final part, let’s see how we can handle a backup of file directories with a large number of files in them (as it is the case for many web sites), and wrap it all up.

Automatic system backups with backup gem and some shell scripting - part 2, using backup gem

20 May 2013

In part 1 of this series we set up a remote image file as the backup storage, with some extra scripts for easier operations.

Now, let’s move on to actually backing up our data, using ruby backup gem. I’ll show you today how you can quickly and easily back up your database, and essential small-to-medium-sized file directories.

Automatic system backups with backup gem and some shell scripting - part 1, the preparation

13 May 2013

One of the most important things when setting up a new application server, especially for a greenfield project on untested hardware, is to make sure you have a solid backup setup to ensure the safety of your data.

Ruby makes it really easy with backup gem, and with some shell scripting we can supplement it to build a really robust and effective backup solution.

vim - Craftsman's Precision Tool

11 May 2013

Slides from my lightning talk about the origins of vim editor, and explaining some basic ideas behind it.

Processes, Threads and Ruby - Presentation Slides

22 April 2013

Presentation from the talk that I gave at JN Solutions office on April, 2013. Gives an introduction into working with processes and threads in Ruby, together with a deeper look at some underlying differences between various Ruby versions and implementations.

Concurrent Programming and Threads in Ruby - a reading list

02 April 2013

Many rubyists consider threads in Ruby as somewhat of an arcane knowledge, though in reality they’re a very well researched and understood concept. Of course, writing effective multithreaded concurrent programs requires certain amount of knowledge and discipline from the programmer, but there’s nothing that a smart one can’t learn if he wants to.

To help with the task, awesome @brainopia compiled a list of recommended reading on the topic of concurrency and threads, traslation of which into English you can find in this post.