ProtonMail is a great service which allows users to escape privacy-invasion from the likes of Google and Gmail, and keep your conversations and affairs private to yourself; unfortunately, their iOS clients suck.

A few years back, in my quest to escape Google’s relentless invasion of my privacy, I moved out of Gmail and adopted Proton Mail as my provider: this has worked great and it also has the added advantage that my communication with other Proton Mail users are encrypted, and my data is stored securely; I can also use my own “vanity domain” for my email, and have been…


With the relatively recent change in the frequency of Java releases (every six months) it has become pretty much required to be able to have multiple JDKs on one’s development machine, and being able to run/test them at different times, for different projects, or even for the same project.

Image for post
Image for post

Originally published at http://codetrips.com on December 29, 2020.

Motivation

While some wizardry with symlinks and similar hackery is possible, on Ubuntu the alternatives system allows a relatively simpler approach.

If one contents oneself with simply having java and javac with alternatives[0], it is simply a matter of running something like:

sudo update-alternatives…

There is something to be said for the immediacy of using Bash scripts, especially when dealing with relatively simple system operations; however, parsing command line arguments has always been rather cumbersome and usually done along the lines of several painful if [[ ${1} == '--build' ]]; then ....

And, yes, I know about getopts : hopefully, no one here is going to argue that it’s either user-friendly or feature rich, now, are we?

Image for post
Image for post

On the other hand, Python is pretty convenient for system operations (especially when using the sh module) but sometimes a bit of an overkill, or just missing…


Merkle Trees store a hash of the sub-tree in each of the Nodes, so that the whole tree’s contents can be validated against tampering.
They are used, for example, in
Bitcoin’s blockchain, and in Cassandra to validate replicas.
In this article, we will show how to implement a generic Merkle Tree using features of Modern C++.

Image for post
Image for post

Previous implementation

A few years ago, we had shown a simplified implementation of Merkle Trees: that one worked, but had a few shortcomings; most notably, using “raw” const char* pointers, it shifted a lot of burden on the client code to keep track of where the…


The STL provides a high-performance queue class in std::queue<T>; however, the API is not very intuitive, or easy, to use and it is not safe to access from multiple threads.
In this article, we will show how to wrap it in a more convenient, and thread-safe, API.

Image for post
Image for post

The C++ Standard Template Library (STL) offers a template-class std::queue<T> that implements Queue semantics: the usual push/ pop/ empty methods to implement a FIFO queue for elements of type T.

The class also offers the ability to specify the underlying Container to use for storage at construction ( is used by default).

The…


Docker was (and still is) a fantastic developer productivity tool, probably the most momentous change after the introduction of Linux. Then VCs came and gave them $300M: it truly was the beginning of the end.

Yesterday, Protocol published an interview with Docker’s “fourth CEO in less than three years,” which provides a reasonably accurate, if not entirely “candid” account of all that went wrong at Docker.

Let’s be clear: even though Linux cgroups (aka, “containers”) have been around for decades, without the undeniable genius of Solomon Hykes and the early-stage Docker employees, they would have probably remained one of the many more or less ingenious, but hard-to-use and obscure Linux features.

Image for post
Image for post
Image by Markus Distelrath from Pixabay

Personally, I still remember attending one of the first Docker meetups, in a (pretty dingy, to be honest) basement of their tiny office: I…


Image for post
Image for post

filecrypt — OpenSSL-based file encryption Rel. 0.7.2

Almost four years after its initial inception and release, I have entirely rewritten the CLI invocation, streamlined the encryption secrets management, and created a self-contained executable.

Once you have a private/public key pair, a file can be simply encrypted using:

./filecrypt.pyz -o my_file.enc /path/to/plain.txt

and decrypted using:

./filecrypt.pyz -o /path/to/plain.txt -d my_file.enc

The --send option allows the user to encrypt a file with the public key of a recipient, and then send the encrypted file to the recipient (who, conceivably, has the private key, and uses it to decrypt it).

All this is…


A handy Bash command to record battery percentage

Image for post
Image for post
Image credit Kellepics on Pixabay

In macOS, the command to emit data about battery status is:

pmset -g batt

If you want to record the battery percentage level in a file at regular intervals, here is how to record the data in a one-liner:

while true; do \ 
echo "$(date "+%Y-%m-%d %H:%M:%S") " \
"$(pmset -g batt | grep "%" | cut -f 2 | cut -f 1 -d ';')" \
>> battery.txt; \
sleep 60; \
done &

which does fit in a single line in Terminal 😉

Originally published at http://codetrips.com on April 5, 2020.


This post describes how to fully automate the build/install of a C++ Project, with several dependencies, using CMake and Conan, a package manager.

Image for post
Image for post
Credit: Stefan Keller (https://pixabay.com/photos/fantasy-light-mood-sky-beautiful-2861107/)

A couple of years back, I needed a simple HTTP client to run some integration tests against a Gossip Server I was developing; it turns out that, something we take for granted in Java, is a rather complicated matter to obtain for a C++ project: I eventually found SimpleHttpRequest and decided to give it a spin.

However, if you look at the project how it was back then it was still a pretty cumbersome build process, including…


“Having a consistent code style across an entire projects (and, even better, across projects) should nowadays be a non-brainer; yet wasting time arguing about matters of style during code reviews is extenuating and unproductive.” Enters Black, “the uncompromising Python code formatter.”

Image for post
Image for post
Image credits: https://pixabay.com/en/users/hoekstrarogier-6883195/

It really is liberating not to have to worry about code formatting, not having to have unproductive, sterile discussions over PRs about code minutiae and yet being reassured that all your code is nicely formatted; most importantly, the quality of the style is not developer-dependent (come on, who has never worked with a lazy slob who cannot quite get…

Marco Massenzio

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store