JSON formatting in DBeaver

This feature really helped me save some time almost daily and it was hiding in plain sight. DBeaver, the open-source database management software, can format JSON columns for you. Before I found this feature, I had to copy paste the column into editor to make sense of the nested …

How not to securely erase a NVME drive

I got a replacement for my Samsung MZVLW256HEHP-000L7 NVMe 256GB M.2 PCI Express X4 SSD, known also simply as Samsung PM961. It is an OEM part. After replacing it with the new one, Samsung 980 1TB, I put the old one on sale. This was my daily driver, so I did not want any meaning…

Restore data from Gitea restic backup

Just a very quick update about how I was able to restore a git repository stored inside a Gitea and backed up via restic. Warning: this guide most probably does not work correctly with LFS files, but they might either not be that critical to restore or the repository might not e…

Throttle with ReCaptcha Laravel middleware

After a few days of struggling I have found a few-lines long solution to the problem of how to show ReCaptcha after a few hits on the endpoint. It is useful for for instance for payment gateway integration, where this way you make sure attacker is not abusing your app to find out…

PHP curly syntax for scope resolution is weird

When browsing a PHP documentation, an example at the bottom of the Complex (curly) syntax section explaining a usage of a scope resolution operator (::) within a curly syntax for strings in PHP caught my eye. Let's look at it: <?php // Show all errors. error_reporting(E_ALL); …

Setting up Tesseract on Ubuntu 18.04

I was presented with a task to quickly prepare a bare-metal Linux machine to run Tesseract OCR for optical character recognition task. The criterion was to to the recognition as fast as possible. In my tests, the Tesseract 5 was far more precise than Tesseract 4, no matter what o…

Laravel validation XOR - Exclusive OR

I needed to create a validation rule in Laravel that would accept either of the two inputs, but not both and at least one had to be supplied. In other words, I had to apply the XOR logic operation on them: ABXOR 000 011 101 110 The search results did offer many solutions but I d…