Carlos Alexandro Becker

Speeding up my ZSH load

This is the story on how I speed up my terminal load time. ...

Flag-oriented Programming

booleans, right? What a wonderful piece of technology! They help us solve so many problems… ...

What is good code?

I’ve been wanting to write this for a long time, just to clarify my thoughts on the subject. Now, on vacations, I took a couple of days and finally did it. This is a personal opinion based on my personal experience and tons of books I have read, and I am not, by any means, the supreme holder of the true, so you will probably disagree with me at some point....

Continuous Delivery with GitHub, CircleCI, Docker and AWS Elastic Beanstalk

This is just a quick overview of how I did it in antibody’s homepage. The site has a very simple index.html plus a service that can discover and download the latest antibody version from GitHub releases. Not sure how relevant this is, but the service is written in Go. Currently, every commit pushed to the master branch of the site repo will be automatically pushed to production. There is no option to skip that....

Parse environment variables to structs in Go

In Go, it’s dead simple to get the value from an environment variable: fmt.Println(os.Getenv("HOME")) But, sometimes you have default values… so you would have to do something like this: home := os.Getenv("HOME") if home == "" { home = "THE DEFAULT HOME" } fmt.Println(home) If you need those values in a lot of places, you would end up creating a function for each one or something like that. I found this to be extremely boring....

Small Go Apps Containers

Or: how to ship your app in a <20Mb container. Well, as you may know, there is a good amount of people now building microservices in Go and deploying them as Docker containers. I do not yet have a lot of experience with Go and Docker, but I’ll try to share what I learned while building and shipping an internal tool, here, at ContaAzul. The Go code example I will assume that you know at least a little bit of Go, and, for the sake of simplicity and brevity, I’ll just use a very basic example from the Go wiki:...

Avoid static imports

There are a lot of Java API’s and Frameworks which rely in static methods and the sort. Arguably, this is a bad OOP practice, but lets not enter this particular subject just yet. For example, it is pretty common to write unit tests like this: package blah; import static org.junit.Assert.assertTrue; import org.junit.Test; public class SomeTest { @Test public void testSomething() { assertTrue(1 + 1 == 2); } } While it’s kind of pretty to import static org....

Cross-compiling Go

go build generates a binary for the platform you run it in. So, if I build antibody in a Linux machine - which uses Mach-O, it will not work in OS X - which uses ELF. I wanted to distribute antibody at least for Linux and OS X, so I went out searching for how to do this in a not so complicated way… I found an article from 2012, demonstrating how to compile Go itself for multiple platforms, so you can use the specific go to build the binary for the specific platform, which is a lot of work to do....

I wrote Antigen in Go: Antibody

Learning Go was in my TODO list for a while, and finally I did something about it. This post contains some thoughts about it… Before we start, I should familiarize you with antigen. Antigen is particularly slow. With the plugins I have, it takes an eternity to load. I saw an attempt to re-write Antigen in Haskell, but I always believed that Antigen does too much, so I decided that it would be a nice thing to play with....

Running a Selenium Grid with docker-compose

At ContaAzul, we had 31 Windows machines powering our Selenium tests - one running the grid and 30 more running clients. Needless to say, this is very expensive. As we are already using Docker to run our builds (on Shippable), we decided to try it out to run Selenium tests too. It was no surprise that Selenium folks already made a ready-to-go set of Docker images. There is an image for the Selenium Grid itself, and the browser images - Chrome and Firefox, also with debug versions - which allow you to access them using VNC to “see what’s happening there”....