[Earthly +v0.8.10 feature]: Disabling Earthly internal labels

Reproducibility in Earthly images

- 2 mins read

Series: Earthly

NOTE: This has not been yet updated in the Earthly documentation, but I’m pretty sure it will be soon (and I’ll update this post accordingly) What does labels do to reproducible builds? By default, Earthly adds dev.earthly.* labels in the built image. You can find these by doing a docker inspect <imageID> | jq -r '.[].Config.Labels'. Here’s an example of the image configuration including the dev.earthly.* labels: "Config": { .

Implementing a functional multi-process function in Bash

Using only wait and jobs commands

- 3 mins read

Series: Bash

If you’re in this post, is because you need to implement a consistent way to add concurrency to your scripts. This implementation is limited, as it does not contemplates grouping jobs for setting different process groups with different settings or priorities. Although, probably most of the cases you just need to execute code that runs inside a block or just simply does something in parallel. The parallel command is a good option, but it requires to loose some code readability, particularly on code blocks that might inject a complex semantic.

Testcontainers' customization for Postgres tests

Go's Testcontainers ephemeral Postgres tests

- 5 mins read

Series: Testcontainers

Testcontainers allows you to test your code with ephemeral containers right inside your tests. It provides different modules for simplifying the process, however, sometimes you many need to customize the container beyond the default parameters or it contents. Source Code of the laboratory. All examples are functional, follow the instructions in the README file for setting up. The csv file is generated by the Docker Compose setup, you can regenerate the example by running docker compose up -d.

Building dynamically-linked binaries in distroless images

SQLite3/Golang use-case example

- 3 mins read
Case I’ve been developing an application in Go that uses SQLite as a local cache of the backend. The story would end there if it wasn’t that I decided to go for a distroless image for opmitization purposes, and also, why not? The thing here is that for enabling certain features of the database/sql driver, the artifact should be dynamically linked through CGO_ENABLED=1 and with the -tags "fts5" (for the FTS5 feature support, see this issue comment).

Using parallel with multiple arguments

Passing multiple arguments in JSON to parallel

- 5 mins read

Series: Bash

A handy tool for parallelization If you are reading this post, is because you have heard about parallel. It is a GNU developed tool for paralelizing commands across sets of arguments. I’ll be honest, I use to forget about its existence until I need to do quick and dirty things when dealing with tasks that require paralelization, and whenever time is a constraint. It has plenty of options and arguments, although once you get up on its usage, it is very handy in many cases.

Ergodox Keyboard Layout for Colemak, QWERTY and Dvorak

The case of ortholinear keyboard solutions

- 5 mins read

Series: Typing

This is my current MacOS Layout. A few months ago, I bought the Ergodox OrthoLinear Split Keyboard. After a period of trying it, I’ve found that the QWERTY layout was considerably uncomfortable to type in the keyboard disposition. I wasn’t the only one, of course, so I started the journey for searching a suitable layout. During a period of time, I switched back and forth between three layouts (QWERTY, Dvorak, and Colemak), although I picked Colemak at the end.

[Useless Code] Swapping variable values with no additional libraries

Like, you want to make your life harder

- 1 min read
Background There was a contest in an internet thread about how to code a variable swap as low-level and minimal as possible. So, I ended up writing a low-level function in C calling instructions for a modern amd64 platform. #include <stdio.h> #include <stdlib.h> void swapshit(int *arg1, int *arg2) { __asm__ __volatile__ ("movl %2, %%eax;" "movl %3, %%ebx;" "movl %%eax, %0;" "movl %%ebx, %1;" : "=g" (*arg2) , "=g" (*arg1) : "a" (*arg1), "b" (*arg2) ); } int main(int argc, char *argv[]) { int arg1 = atoi(argv[1]); int arg2 = atoi(argv[2]); swapshit(&arg1,&arg2); printf("arg1 es %d , arg2 es %d\n",arg1,arg2); return 0; } The explanation of the above is quite simple.