Piero V.

Certificate auth on WeeChat with a passphrase

In the latest months, I have been using IRC almost daily.

Before, I had used it only a few times. I only knew that this protocol is old, actually older than me 😄.

And I immediately saw that it lacks many of the features of modern systems.

Certificate authentication

One above all is registration and authentication. Many networks implement it through the NickServ user.

However, the authentication would involve sending the password as a message. Therefore, another mechanism based on a self-signed certificate is often preferred.

I am on OFTC, and t hey have a guide, which I initially followed (except for the algorithm: I changed rsa:2048 with ed25519).

Beware that this command does not ask for a passphrase! This was good enough for me since I was running HexChat on my PC, on which I use full-disk encryption.

You may want to encrypt the private key instead, and it is best to do it at the creation time.

Offline messages

But sadly, IRC does not have a feature that many (me included) take for granted today: offline messages. … [Leggi il resto]

Constructive Solid Geometry in JS

From time to time, I like playing with 3D graphics, especially from a programmer’s point of view.

Constructive solid geometry, or CSG, is a modeling technique involving combining simpler objects with Boolean operations to obtain more complex ones.

A while ago, I found an implementation as a JavaScript library: CSG.js.

It really is brilliant because it is a complete tool in less than 600 rows, half of which are explanatory comments.

Its foundations are the clipping and the inversion operation. The former removes parts of a BSP tree inside another BSP tree, the latter swaps solid and empty space.

CSG.js combines them cleverly to implement Boolean union, subtraction, and intersection.

Even from a software engineering perspective, its author made some acute choices. And as a result, this project did not need to be updated in the latest ten years!

For example, library users can implement vertices with custom properties thanks to duck typing. They just need to implement a few methods and have a pos member. In this way, it is possible, for instance, to manage texture coordinates. … [Leggi il resto]

Linux cryptsetup and rEFInd

TL; DR: create a /boot/refind_linux.conf file with the following content:

"Boot with standard options"  "root=UUID=uuid-of-unencrypted-root-partition ro cryptdevice=UUID=uuid-of-luks-partition:volume-name:allow-discards quiet"
"Boot to single-user mode"    "root=UUID=uuid-of-unencrypted-root-partition ro cryptdevice=UUID=uuid-of-luks-partition:volume-name:allow-discards quiet single"
"Boot with minimal options"   "root=UUID=uuid-of-unencrypted-root-partition ro cryptdevice=UUID=uuid-of-luks-partition:volume-name:allow-discards"

The rest of the article is a nice story about why I needed this 😄️.

More fast storage!

I built my current desktop two years ago with the first money I earned during my internship. So, I was on a budget, and cheapening on the storage is always a way to save some bucks.

Therefore, I bought a WD Black 250GB SSD to dual boot my systems and a 2TB hard disk for the data.

Recently I changed job, and now I use my personal desktop to work. And I need more fast storage.

So, since I was already upgrading, I finally switched to full-disk encryption and btrfs. … [Leggi il resto]

Thunderbird 78+ and OpenPGP secrets

I have used OpenPGP for a while now, usually with GPG. I use it, especially with my password manager on my Debian box. The GNOME folks did a great job with password prompts for it and for the SSH agent.

Recently, I started using encryption and digital signatures also for emails.

I use Thunderbird as a client. With version 78, its authors deprecated the old plugin APIs. Enigmail, the addon that provided OpenPGP with a GPG integration, became incompatible. However, they also decided to support this feature natively.

While most of Thunderbird’s source code is released under MPL, GPG is released under the GNU GPL 3.0 or later. Therefore, they preferred using another library. And so, they also waived the great integrations that GPG already has.

Thunderbird's prompt for the key passphrase

So, what is different in this screenshot from the usual Thunderbird password prompts? … [Leggi il resto]

OpenCV and time lapses

After buying my Pixel 4a, I decided to take a picture of a poplar near my home every day. I did this for one year, and I created a time lapse. But I will not publish it here because it would reveal where my home is 😜️.

Methodical is not enough

With time lapses, you usually keep your camera still, but this was not an option in my case. Therefore, I tried to be methodical in taking the various pictures.

I used a sewer cover as a point to shoot the photo and a telephone pole as a reference (its tip is close to the upper-left corner in every picture).

Still, the results were varied, but luckily OpenCV came to the rescue.

Homography matrices

We could say that my scenario is like capturing the same scene with different cameras. Therefore, we can compute the homography matrix to reproject one image to the previous one.

And OpenCV has a very handful function to do so: findHomography. It takes the coordinates of corresponding points as inputs, and it returns a 3-by-3 matrix as output.

If you are using Python, you must pass the points as two NumPy matrices. Both must have the same shapes: a row for each pair and two columns with the coordinates. The point at the ith row of the first array must correspond to the point at the ith row of the second array. … [Leggi il resto]