Using Tmux

A long time ago I discovered screen. It made it possible to start applications in Linux and then disconnecting the SSH session, without stopping the applications. It was magic: otherwise the the applications just terminated if the SSH connection was lost. Then I heard about tmux. It was like screen on steroids! I could split […]

Count Lines of Python Code

I have created a new application called lopc (Lines of Python Code). It is available for install with pip on PyPI (, and the source code is available on GitHub: The app really only counts the number of non-empty and non-comment lines of *.py files in the given directories. These are some features of […]

Python f-String Formatting Codes

Here is my short list about the common f-string formatting codes in Python: >>> score = 123.728 >>> f”{score}” ‘123.728’ Minimum field length: >>> f”{score:>10}” ‘ 123.728’ >>> f”{score:<10}” ‘123.728 ‘ >>> f”{score:^10}” ‘ 123.728 ‘ Number of decimals: >>> f”{score:.2f}” ‘123.73’ >>> f”{score:10.2f}” ‘ 123.73’ >>> f”{score:<10.2f}” ‘123.73 ‘ Padded with a character: >>> […]

Zabbix Active Agent Autoregistration

Let’s see how the Zabbix active agent autoregistration works in the communication. I have configured the Zabbix agent (version 6.2.3) on the Linux host at with this configuration: ServerActive= Hostname=Test-agent After restarting the agent, the Zabbix server (version 6.2.3) at logged immediately in /var/log/zabbix/zabbix_server.log: cannot send list of active checks to “”: host […]

Configuring Logging in NetBox

Creating the log file and setting the permissions: $ sudo mkdir /var/log/netbox $ sudo touch /var/log/netbox/netbox.log $ sudo chown -R netbox.netbox /var/log/netbox $ Configuring NetBox (in /opt/netbox/netbox/netbox/ You can set the level for the loggers as needed, in this setup the file handler accepts DEBUG and higher but the actual loggers (“django” and “netbox”) only […]

Basic Mocking with Pytest

Since I always seem to search for these examples over and over again, here it is, basic mocking with pytest. My example code is this ( It can be run: $ python3 In testfunc, sleeping $ Not surprisingly, running it takes about five seconds. The time.sleep() call simulates some long-running operation in the code. […]