If you’re in this post, is because you need to implement a consistent way to add parallelization 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 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.
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).
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.
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.
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.
The explanation of the above is quite simple. We use registers to allocate the values and call them in a different order
using movl instruction. The main is just a wrapper that passes arguments.