Image by 👀 Mabel Amber, who will one day from Pixabay

GnuPG (gpg) is a great utility that is usually available both on Linux and Mac. It can be used for generating encryption and signing keys and using them to encrypt and decrypt your sensitive data. Here’s a quick cheat sheet for basic usage scenarios.

Generating a new key

Generate a new gpg key:

gpg --full-generate-key
  • What kind of key you want? (RSA and RSA)
  • What keysize do you want? (3072)
  • How long the key should be valid? (the key does not expire)
  • Real name? (Input a name to identify…

Image by SweetMellowChill from Pixabay

In this article, I’ll explain in detail the solution for the “Strange Printer” coding problem. It’s featured on multiple coding exercise websites, you may have encountered it at LeetCode by the number of 664.

Problem description

Suppose you have a printer whose purpose is to generate a string of lowercase English characters. The limitation of the printer is that at each step, it can only print a string containing the same character, e.g. aaa, b, or cccc.

The trick is that the printer doesn’t print out the steps in sequence, but rather can start printing at any place, possibly overwriting the results…


Image by Prettysleepy from Pixabay

Sometimes you may want to move or advance a tag as part of your GitHub Actions pipeline.

First, make sure you know what you’re doing — moving tags in a git repository is generally a bad idea, since it may mess with other people’s repositories and incur non-reproducible build and deployment issues. However, there are some workflows and cases that justify moving tags.

For instance, you may have a latest, or a nightly tag in your repository, which you use to execute a nightly build.

If you want to manually move a tag using your local development environment, this would…


Image by HowardWilks from Pixabay

You may wonder how long a particular line of Java code executes. If this line is part of your code, it’s easy to find out by putting System.currentTimeMillis() calls before and after the line and finding the difference. But what if this line of code is part of a library or a framework? You could use a profiler, but a quicker and easier way might be to use breakpoints in IDEA.

Put a breakpoint on the line you want to profile (e.g. …


Image by meineresterampe from Pixabay

Encrypting an existing user home folder in Ubuntu should be a single-command task, but it got tricky for me with some complications. I’ll try to explain what issues I had and how I fixed them. I used the latest LTS 20.04.1 version of Ubuntu.

First off, you’ll probably want to encrypt the whole drive instead, since some sensitive data may reside not only in your home folder but also outside of it. …


Image by Bessi from Pixabay

The Kotlin programming language has two distinct features that may be used for similar purposes. Those are inline classes and type aliases. You could use them to improve code clarity and type safety, but what’s the difference between them? This is the topic of this article.

Type Aliases

Type aliases first appeared in Kotlin version 1.1. They effectively allow you to declare a new name for any existing type. This declaration doesn’t create a new type, and you can pass the aliased type wherever the alias is expected (something that’s called assignment compatibility):

typealias Str = Stringval s: Str = "Hello"


Image by Pexels from Pixabay

If your work as a software developer is not directly related to open source (i.e. you don’t spend most of your working time supporting or contributing to an open-source project), your GitHub profile may be blank, except for some study projects and test assignments.

This is not necessarily bad, and it doesn’t make you a bad developer. But probably you’d like to create outside visibility of your work and boast some green tiles on your GitHub contributions timeline. So here’s a couple of tips to get you started.

Find Time in Your Working Hours

Woah, this is certainly not about sneakily hacking on open source projects…


Image by Dimitri Houtteman from Pixabay

In this guide, I’ll explain what Docker labels are, what can you use them for, and how to set them on image and container level.

What are the Labels?

Labels are key-value pairs you can attach to almost everything in Docker. You define both keys and values for the labels.

Labels are metadata, meaning they don’t affect the functionality or configuration of the image or container, but you can inspect them. You can put them on images, containers, networks, volumes, etc.

There’s lots of different use case for labels, including, but not limited to the following:

  • you can label an image with git commit…

Image by Free-Photos from Pixabay

Testing transactional routes in Apache Camel can get tricky, especially if the test involves JMS queues or XA (two-phase commit) transactions. Tests may sometimes fail, even if we use NotifyBuilder to wait for the route to complete. In this article, I’ll show how to fix issues with the testing of transactional routes in Camel.

The complete code for this article is available on GitHub.

Problem with Testing Transactional Routes

Suppose we have a route that takes a message from the queue and puts it to the database. That’s a typical use case for XA transactions, provided you’ve set them up the right way, as I’ve…


Image by GregoryButler from Pixabay

In Hibernate, there’s a mystical option enableExtendedEnhancement intended for fine-tuning of the bytecode enhancement. This option is not described well in the documentation. This article explains what it is, how to use it, and what benefits it may bring to you.

Project Configuration

To demo the effect of Hibernate’s extended enhancement, we’ll start with a simple entity class Cat that contains two fields: an automatically generated id and a name:

Dirty Checking

Hibernate can…

Sergei

Technical project lead @ CRX Markets. I mostly write about Java and microservice architecture. Occasional rants on software development in general.

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