How to configure and use a reiner SCT card reader with a german ID in Linux Mint

IMPORTANT: You need a PIN to use the card reader. If you don't have it, you can get it from the Bürgeramt. Without the PIN, you can't use the card as an authentication method. If you try to force it, you will block the card, and you will need to get a new one. You have been warned.

Context

The German ID card is a smart card that can be used for authentication in many government websites. In order to use it, you need a card reader. You can use a Smartphone as a SmartReader on Windows and macOS. I haven't tried it to do it on Linux. The other option is to use a card reader. I bought a used a Reiner SCT cyberJack RFID standard from KleinAnzeigen.

In this post, I will explain how to configure and use a Reiner SCT card reader with a German ID in Linux Mint. I am using Linux Mint 21 Cinnamon (Vanessa).

Why is this interesting?

There are several services available online be Finanz Amt, Stadt Essen and other government agencies. You can use the card to authenticate yourself and use the services. For example, you can use it to submit your tax declaration, to get certificates, to fill forms and so on. All without leaving your home.

In the case of Stadt Essen you can find all the available services here: https://service.essen.de/home

What do you need?

  • A Reiner SCT card reader. I am using a Reiner SCT cyberJack RFID standard. (There are other available, but I found on a short internet search that this one is the most compatible with Linux.)
  • A German ID smart card. You can get it from the Bürgeramt.
  • A PIN to use the card reader. You can get it from the Bürgeramt.
  • A computer with Linux Mint installed. I am using Linux Mint 21 Cinnamon (Vanessa).

Steps

1. Install the required packages

sudo apt-get install pcscd libccid

2. Check if the card reader is detected by the system

lsusb | grep Reiner

If the card reader is detected, you should see something like this:

 lsusb | grep Reiner
Bus 005 Device 020: ID 0c4b:9102 Reiner SCT Kartensysteme GmbH cyberJack RFID basis contactless smartcard reader

3. Restart the pcscd service

sudo killall /usr/sbin/pcscd; sudo /usr/sbin/pcscd --foreground --debug --apdu --color

4. Install the app to use the card as an authentication method AusweisApp2

You can download the app from https://www.ausweisapp.bund.de/open-source-software or search for "AusweisApp2" in "Discover" (the app store of Linux Mint). It is available as a flatpak.

You may also install it using the command line:

flatpak install de.bund.ausweisapp.ausweisapp2

Now you should be able to use the Card Reader with the German ID. Don't forget to get the PIN from the Bürgeramt. There you will receive a with a 5-digit PIN. You will need to change it to a 6-digit PIN in the AusweisApp2 app. Please save that 6-digit PIN in a safe place. You will need it to use the card as an authentication method. (I recommend and use KeepassXC to store my passwords. You may also use you Iphone or Android phone to store your passwords.)

5. OPTIONAL: Deactivate automatic deactivation of the pcsc service

sudo nano /lib/systemd/system/pcscd.service

and remove the ´´--auto-exit´´ option from the ExecStart line. Save the file (ctrl + o) and exit (ctrl + x). You may also use another editor like vim or gedit.

Troubleshooting

The card readers is detected but the AusweisApp2 says that the card reader is not available.

In this case just restart the pcscd service. Check the steps above.

References

How to auto restart command/ process in Linux after specific run time or duration (quick-note)

Context

You want to auto-restart a command or process in Linux after specific run time, duration or time period.

For this you can use the timeout command in a while loop.

while true; do
    timeout 10 htop --tree
    true # you have to have true so that the while lop doesn't break. You might also do en echo.
done

where:

  • timeout 10 means 10 seconds
  • htop --tree is the command you want to run

You may also use echo instead of true after the command

while true; do
    timeout 10 htop --tree
    echo "restarting process..."
done

References

  • https://unix.stackexchange.com/questions/591040/how-to-repeatedly-stop-and-restart-a-command

Navigating the Python Development Ecosystem: The Essential Tools and Techniques - An opinionated guide

This article is highly opinionated. These are the tools and workflows that I use (as of 2023). Thus, this is not a list of the best tools out there nor a list of the best way to learn. This is a list that has worked for me and is subject to change.

Context

I was trying to help someone I know get started in Python (and Data Science). He already did some courses in Data Science (and thus has at least a basic understanding), but I realized all the surrounding tools were not explained in the courses he took.

Once I started, I found myself explaining several tools, systems, and apps I use daily. After a couple of hours, I thought it would be good to document this as a series of posts, as this is not the first time, nor the last time, I will be explaining such things.

Base operating system

In my opinion, the most important tool out there. It allows you to interact with your computer and limits (so to speak) what you can and can´t do with it.

There are 3 main operating systems:

  • Microsoft Windows

  • Apple macOS

  • GNU/Linux distributions

If you want to understand the ins and outs of everything, I really recommend GNU/Linux. It is the main operating system in servers, in containers (check the table of ocntents of this article), in Android and many other places. It runs almost everywhere, and need a lot less resources than any other option.

To get started I recommend Linux Mint, Ubuntu Linux and openSUSE Tumbleweed (in that order).

I use openSUSE Tumbleweed because it is stable and a rolling release, Linux Mint on the Desktop because it just works, and Ubuntu and Debian on servers. I own a Mac but now I rarily use it, and I have a dual-boot with windows just in case I need it.

If you want something that just works, but still is compatible with Linux (and its terminal), you should go with macOS (if your budget allows).

If you are in a Microsoft environment (meaning you depend on OneDrive, Microsoft Excel with advanced macros, devices that only run on Windows and so on) you should go with windows. For development in Windows 11 you should try WSL2, which is a way to run Linux in Windows.

Tools for developers

Let’s start with the tools I use.

Git

The first one is git. I already wrote an article about git here: What is Git (version control system) and why you need to use it for your projects (any project with files and content, not just code). If you don’t know what git is, I would recommend you to read it.

What is git?
Git is a version control system (VCS) which allows you to track changes to a file or set of files over time.

Why is this great, important and cool? It allows you to collaborate on projects with other people, to track different versions, to un-do mistakes, to see the code history, to try new things without breaking everything. Just read the article or check out the Git Documentation

Development workspace

A development workspace is an environment that provides all the necessary tools and dependencies required to build, test, and deploy applications, hopefully in a way that is versionable and replicable.

To create a development workspace, one can use Virtual Machines (VMs), Containers, or LXC (Linux Containers). VMs are a good choice for creating isolated environments that can run different operating systems, while containers provide a lightweight and portable solution that can be easily shared across multiple machines. LXC, on the other hand, provides a way to create and manage system-level containers that can run multiple isolated Linux systems on a single host.

Let’s check the main ones.

VMs (Virtual Machines or Containers)

Virtual machines are another way to isolate a development environment (additionally or as an alternative to Conda and virtualenv).

Virtual machines are usually those where you can install a whole operating system. The most common ones are:

From those, XEN, KVM, Virtualbox and QEMU are open-source projects, while VMWare is a commercial product.

Virtualbox comes with a CLI and a GUI and works under Linux, Mac, and Windows.

To use XEN, KVM and QEMU you need to use the terminal or an additional GUI, such as virt-manager (libvirt) or a shell tool such as Virsh (also libvirt) under Linux.

There are a couple of important concepts you should know:

  • base operating system: is your main operating system (OS). On a Mac is typically macOS, on most desktops and notebooks is Windows and on some others is a Linux distribution (such as Ubuntu, Debian, Fedora, openSUSE, Manjaro, Linux Mint, etc…).

  • guest operating system: the system you are installing on the virtual machine. For example, you can install Ubuntu (Linux).

  • extensions: a way to integrate your base and guest operating systems to make their use easier. For example, you can sync the clipboards, mount directories, share files, record the screen and so on.

Virtualbox

If you want to try different operating systems, Linux distributions, or you wish to have setups or workspaces for specific projects, then Virtualbox is the easiest way to do that.

While there are alternatives out there, VirtualBox runs almost everywhere and is pretty well integrated into the base OS.

LXC, Docker or Podman

Linux containers, Docker containers, and Podman containers are always to package software applications and their dependencies into self-contained units (thus containers, because they contain something) that can be easily shared, run, and managed across different computing environments. They provide a more efficient and reliable way to deploy and manage software applications, while also improving security and portability.

In other words, is a way to not mix different versions of packages and libraries in your base OS. This allows you to develop and test software using different versions (for example, Python 2.7 and Python 3.10), without installing those specific versions in your system. Because it is self-contained, you can share these environments and other (when correctly configured) can use them without many problems.

In a way, this is similar to Conda environments.

From the following, the most used alternative right now is docker (together with docker-compose)

Containerization Technology Supported Operating Systems URL Short Description Main Company Intercompatibility

LXC

Linux

https://linuxcontainers.org/lxc/

LXC is an OS-level virtualization method that allows running multiple isolated Linux systems (containers) on a single Linux host. It provides a way to manage containers through a daemon, which can be controlled using the LXC command-line tools.

Canonical

Compatible with Docker images.

Docker

Linux, Windows, macOS

https://www.docker.com/

Docker is a platform for building, shipping, and running distributed applications in containers. It provides a way to create, deploy, and manage containers using a client-server architecture, where the Docker daemon manages the containers and the Docker CLI controls the daemon.

Docker, Inc.

Compatible with Podman and Kubernetes.

Podman

Linux

https://podman.io/

Podman is a daemonless container engine that allows running containers as regular users without requiring a daemon running as a privileged process. It provides a command-line interface for managing containers and images, and can run Docker images as well.

Red Hat

Compatible with Docker images and Kubernetes.

Terminal/ command line/ shell

As you dive into programming, you will find yourself using the terminal more and more.

The terms terminal, command line and shell refer in this article to the same thing: a text-based interface to a computer (local or remote), where you type in commands and get text-based responses, rather than clicking on icons and windows with a graphical user interface.

There are many reasons to use the terminal, but you will eventually find that using the command line for some tasks is easier and faster.

For example, you can:

  • navigate your file system

  • use docker

  • use ssh to access remote machines

  • file operations (copy, move, remove, sync, etc…​)

By default, in most GNU/Linux systems you will have bash (new versions of mac and some Linux-distributions have zsh and window uses cmd or powershell).

Pump up my shell

A bare shell is enough at first, but you may improve your shell experience with some apps and plugins.

There are mainly 3 ways to improve your shell:

  1. Install zsh (another shell similar to bash but newer) and install some add-ons such as ohmyzsh, zinit or similar.

  2. Install another shell such as fish

  3. Install a universal app to improve your shell such as starship.

I have user ohmyzsh and zinit on zsh with great results, but because bash is almost everywhere by default, I started to use starship.

Here is a quick comparison table of the three:

Shell Description URL Stars Last Update OS Support Features

zsh + ohmyzsh

Oh My Zsh is a community-driven framework for managing your Zsh configuration. It comes bundled with several helpful functions, helpers, plugins, and themes that make it easy to customize your terminal experience.

https://github.com/ohmyzsh/ohmyzsh

GitHub stars

GitHub last commit

Windows, Linux, macOS

Syntax highlighting, Auto-suggestion, Git aliases, Plugin manager

bash + starship

Starship is a minimal, blazing-fast, and infinitely customizable prompt for any shell. It provides useful information about the current directory, git branch and status, as well as customizable prompts and icons.

https://starship.rs/

GitHub stars

GitHub last commit

Windows, Linux, macOS

Syntax highlighting, Auto-suggestion, Git integration, Customizable prompt

fish + ohmyfish

Oh My Fish is a fast, fully-featured framework for the fish shell. It includes a wide range of plugins and themes that can be easily installed and customized. Fish is designed to be simple and easy to use, with a clean syntax and powerful features.

https://github.com/oh-my-fish/oh-my-fish

GitHub stars

GitHub last commit

Windows, Linux, macOS

Autosuggestions, Abbreviations, Syntax highlighting, Plugin manager, Theme manager

Tools for python

Virtual environments

A virtual environment is a way to isolate a specific version of python and a mix of modules in specific versions.

Why is this important?

Python and python packages (for example pandas, requests, etc.) are always in development, and they add, remove or change some features.

Let’s take pandas as an example: Before pandas 1.5 the best way to get a row/column pair was with df.loc`[1] or `df.iloc. After pandas v1.5 the proper way is to use df.at.[2]

With virtual environments, you can run your project with pandas 1.4, for example, while you update your code to work with pandas 1.5 (in another virtual environment).

The virtual environment is just the part which isolates it from the base system (in this case, the python packages from your main operating system). Additionally, you need a way to add packages and modules. This is called package manager.

In python 2 usual ones are Conda and pip.

Pip is generally used together with virtualenv.

Conda includes its own way to manager virtual environments, and may also use pip for the packages not available in its main package repository or in conda-forge.

I use both of them depending on what I’m doing.

For example, after installing Conda you can create an environment env and add packages for something. In this example, I will create an environment called ds (for data science) and add pandas to it.

# create en environment in conda

conda create --name ds

# activate environment

conda activate ds

# install pandas and jupyter lab from conda-forge

conda install -c conda-forge jupyterlab pandas

# now you can run jupyter lab
jupyter lab

In comparison with virtualenv, you can activate a Conda environment from any path.

There are 4 main differences between Conda and virtualenv:

  1. Creation of a virtual environment: For virtualenv you need to first activate the environment using the path to it and then use pip to install packages. Every time you want to activate this virtual environment, you have to give the path (of course you could create shell aliases and stuff like that, but I find Conda to be easier).

  2. Activation of the virtual environment: Another big difference is that you have to give virtualenv a path where it should create the new environment, while Conda uses the same root folder for all (in Linux, ~/miniconda3 by default).

  3. Different commands in different operating systems Conda always has the same way of creating and activating the virtual environment. On the other hand, with virtualenv you have to change the way you activate it depending on the operating system you are using. Check this link for more information

  4. Python and other packages: in Conda you can install more than just python packages, and it also has pre-compiled python packages (bin). For example, in Conda you can also install R-packages and R.

The same example as before, but using virtualenv, is:

# create a new virtual environment
python3 -m venv /path/to/new/virtual/environment

# activate environment, where <venv> is the path/to/new/virtual/environment
source <venv>/bin/activate # in bash/zsh
source <venv>/bin/activate.fish # in fish
<venv>/bin/Activate.ps1 # in PowerShell
<venv>\Scripts\activate.bat # in cmd.exe

# install jupyter lab and pandas
pip install jupyterlab pandas

# now you can run jupyter lab
jupyter lab

miniconda

What is miniconda?
Miniconda is a free minimal installer for Conda. It is a small, bootstrap version of Anaconda that includes only Conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others.
— [https://docs.conda.io/en/latest/miniconda.html]

virtualenv/ venv

virtualenv is a tool to create isolated Python environments. Since Python 3.3, a subset of it has been integrated into the standard library under the venv module. The venv module does not offer all features of this library, to name just a few more prominent.
— https://docs.python.org/3/library/venv.html

You use venv or virtualenv usually for deployment, as it is supported almost everywhere. For example, to deploy a python-based static site to GitHub Pages, GitLab Pages or Cloudflare Pages, you will need a requirements.txt, which is the main file of a venv, where all the dependencies are listed.

poetry

I tried poetry, but I stopped. I don’t really remember why, but I’m ok for now using conda, virtualenv and docker.

I might check it again in the future.

If you want to check it out, visit https://python-poetry.org/

IDEs (Integrated Development environments)

An IDE is an application that provides a comprehensive and integrated set of tools for software development (although I also use them for writing this blog because of git integration, autocompletion and syntax-highlighting). It is typically used by programmers and developers to write, test, and debug software code more efficiently and effectively.

An IDE typically includes

  1. a code editor that provides features such as

    1. syntax highlighting,

    2. code completion, and

    3. automatic indentation

to help developers write code more quickly and accurately.

It may also include a debugger that allows developers to step through their code and identify and fix errors more easily.

Other features of an IDE may include

  1. version control integration,

  2. command-line integration

  3. project management tools, and

  4. support for multiple programming languages.

Lately, some of them also include AI Add-ons such as GitHub Co-Pilot.

Using AI to code is cool, but has its dangers. The code does not always work, nor does it do what you want. I wouldn’t recommend using such tools unless you can fix the code or, at least, understand what it does. Don’t just blindly trust auto-generated code. You have been warned.

A list of IDEs for Python is available at Wikipedia

I use these 3 IDEs depending on the task on hand. To try new things I go with Jupyter Lab, for big projects (and at work) and commit to git I go with PyCharm and for everything else, including remote coding from an iPhone, I go with VS Code. You don’t have to decide on one, but it helps if you have at least the same keybindings.

PyCharm

PyCharm is an integrated development environment (IDE) used for programming in Python. It provides code analysis, a graphical debugger, an integrated unit tester, integration with version control systems, and supports web development with Django. PyCharm is developed by the Czech company JetBrains.
— Wikipedia

I have to say, that the integration of Git in JetBrains products (I also use PHPStorm) is the best I have seen.

PyCharm works really good and has everything you would want to use, but is a little heavy on ressorce-use (in comparison with vscode, for example).

There are 2 versions:

  1. Community edition

  2. Commercial edition

The main differences are in the quantity of programming languages it supports, the integrated framework support (for example Django) and remote interpreters. Of course, besides price.

If you are new to this, the community version will suffice for your needs.

You can find a comparison here at JetBrains

Visual Studio Code (vscode or code)

Visual Studio Code is an Open-Source project from Microsoft. It really runs everywhere and has a lot of extensions. It has built-in git support, IntelliSense[3]

You can install it on Linux, Windows, Mac, a headless server and access it through a browser, is integrated in GitHub Code Spaces, on the web and in many other places.

If you want a lightweight and customizable IDE, but at the same time flexible and powerful, git VSCode a try.

Jupyter Notebooks/ Jupyter Labs

Jupyter Notebook/ Lab is a web-based interactive IDE, mostly used in data science projects. Its main “work unit” is a Jupyter Notebook (called document) and allows you to get inline results. You can see the results of part of your code without running all of it.

JupyterLab is the latest web-based interactive development environment for notebooks, code, and data. Its flexible interface allows users to configure and arrange workflows in data science, scientific computing, computational journalism, and machine learning. A modular design invites extensions to expand and enrich functionality.
— jupyter.org

It’s important to note that Jupyter supports many programming languages through kernels. You can use, as far as I know, C++, Julia, Octave, R, Ruby, Python, and PHP. There are many more kernels available, as it is an open-source and community-driven project. Here you can find a list of supported kernels.

Key takeaways

  1. Operating systems (OS) allow you to interact with your computer and limit what you can do with it. The main OS are Microsoft Windows, Apple macOS, and GNU/Linux.

  2. Git is a version control system that allows you to track changes to a file or set of files over time. It’s essential for collaboration on projects, tracking different versions, undoing mistakes, and trying new things.

  3. Development workspaces provide all the necessary tools and dependencies required to build, test, and deploy applications. They can be created using Virtual Machines (VMs), Containers, or LXC (Linux Containers).

  4. Virtualbox is an easy way to try different OS and setups. Containers are a way to package software applications and their dependencies into self-contained units that can be easily shared, run, and managed across different computing environments.

  5. LXC, Docker, and Podman are popular containerization technologies. LXC allows running multiple isolated Linux systems on a single Linux host, while Docker is a platform for building, shipping, and running distributed applications in containers. Podman is a daemonless container engine that allows running containers as regular users without requiring a daemon running as a privileged process.


3. Go beyond syntax highlighting and autocomplete with IntelliSense, which provides smart completions based on variable types, function definitions, and imported modules. (https://code.visualstudio.com/)

(Quick-note) SSH Keys Permissions

Context

You want to add a SSH Key to your SSH Agent and you get an error Permissions are too open.

 ssh-add ~/.ssh/id_rsa  
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @  
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  
Permissions 0644 for '/home/daco/.ssh/id_rsa' are too open.  
It is required that your private key files are NOT accessible by others.  
This private key will be ignored.

Solution

If your keys need to be only readable by you:

chmod 400 ~/.ssh/id_rsa

If your keys need to be read-writable by you:

chmod 600 ~/.ssh/id_rsa

After that you can add your key

ssh-add ~/.ssh/id_rsa

Could not open connection to your authentication agent

If you get this error

 ssh-add ~/.ssh/id_rsa  
Could not open a connection to your authentication agent.

just eval your agent

eval `ssh-agent`

and then proceed to add your keys.

Reference

How to deal with dates, dates with timezones and dates with particular formats with python and pandas (code snippets for different use cases)

Context

When dealing with dates, I’ve sometimes problems because the source is not clean, or not all the rows have the same format. Additionally, dates can be simple (year-month-day) or really complicate like a timestamp with timezone.

Here are some code snippets for several use cases.

How to read dates with python and pandas

# import pandas
import pandas as pd

# df is a dataframe with a column 'column_with_date' with a date like this '19.01.2023 16:45:46 +01:00'
# convert date string to datetime with pd.to_datetime
pd.to_datetime(df['column_with_date'])

# sometimes the format is a bit weird and pandas cannot recognize it. In this case we give the date format as argument.
# for this format 19.01.2023 16:45:46 +01:00 we can use:
pd.to_datetime(df['column_with_date'], format='%Y-%m-%d %H:%M:%S%z')

# if your string has timezone, use utr=True
pd.to_datetime(df['column_with_date'], format='%Y-%m-%d %H:%M:%S%z', utc=True)

# sometimes your columns are as objects (strings) and numbers (floats, ints) and to_datetime cannot process it. 
# You can force the type string to the whole column before giving it to to_datetime.

pd.to_datetime(df['column_with_date'].astype(str), format='%Y-%m-%d %H:%M:%S%z', utc=True)

# pd.to_datetime does not modify the column values in place, so you have to assign it to the same column.

df['column_with_date'] = pd.to_datetime(df['column_with_date'].astype(str), format='%Y-%m-%d %H:%M:%S%z', utc=True)

# or save it to another (new) column if you want to save the original value
df['column_with_date_2'] = pd.to_datetime(df['column_with_date'].astype(str), format='%Y-%m-%d %H:%M:%S%z', utc=True)

How to save dates with UTC (tiemzone) to an Excel-File with Pandas

Saving datetime columns with timezones in pandas is not supported, and you will get the following error if you try:

ValueError: Excel does not support datetimes with timezones. Please ensure that datetimes are timezone unaware before writing to Excel.

To remove the timezone from a datefield (column dtype datetime64[ns, UTC]) you can use .dt.date()

# remove timezones for excel
df['column_with_date'] = df['column_with_date'].apply(lambda d: pd.to_datetime(d).date()) 

# save te file as usual
df.to_excel('filename.xlsx')

References

  • https://stackoverflow.com/a/63238008/624088
  • https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes -> format codes for datetime strings
  • try and error :)

How to set up fingerprint authentication on openSuse Tumbleweed and KDE Plasma

Context

I have an old Toshiba Notebook which has a Fingerprint device and I wanted to use it to authenticate myself in KDE on openSuse. Similar steps should work on GNOME and other Distros. At the end of the article you can find a reference for KDE running on debian-based distros.

Check if your fingerprint reader device is supported

Run lsusb and check for any device with fingerprint.

(ds) [email protected]:~> lsusb  
Bus 004 Device 003: ID 8086:0189 Intel Corp. Centrino Advanced-N 6230 Bluetooth adapter  
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub  
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub  
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  
Bus 001 Device 020: ID 0930:1314 Toshiba Corp. F5521gw  
Bus 001 Device 004: ID 0bda:58f5 Realtek Semiconductor Corp. 2SF001  
Bus 001 Device 018: ID 08ff:168b AuthenTec, Inc. Fingerprint Sensor
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

If you find any, copy the ID (in my case is 08ff:168b) and check if it is supported in https://fprint.freedesktop.org/supported-devices.html

if you find it, then follow the next steps 😃

Install requirements

fprintd and fprintd-pam

Use YaST Software or the following command

sudo zypper install fprintd fprintd-pam

Register your fingerprints In KDE

Configure your system (window-manager and KDE lock Screen) to use and allow fingerprint for authentication

Window Manager

kdesu kate /etc/pam.d/sddm

add the following after #%PAM-1.0

auth    [success=1 new_authtok_reqd=1 default=ignore]   pam_unix.so try_first_pass likeauth nullok
auth    sufficient      pam_fprintd.so

KDE Lock screen

# this will edit or create a file
kdesu kate /etc/pam.d/kde

and add the following

auth            sufficient      pam_unix.so try_first_pass likeauth nullok
auth            sufficient      pam_fprintd.so

and restart sddm

sudo service sddm restart

now you should be able to use your fingerprint to login. Check it out by locking KDE (or press win + l). There should be a message to use fingerprint or password to unlock/ login.

follow: https://en.opensuse.org/SDB:Using_fingerprint_authentication

References

How to add a table of contents (TOC) to a markdown post or page to nikola ssg

You want to add an automatically created table of content to your markdown post in Nikola SSG.

Nikola uses by default python-markdown which supports the toc extension.

First you need to enable the markdown extension in config.py

MARKDOWN_EXTENSIONS = ['markdown.extensions.toc']

Then add the short code for TOC in your markdown file

[TOC]

References

How to find all processes with a specific string in their name and kill them all (in linux command line using ps, grep and awk)

Context

You want to find all the processes of, for example, visual studio code, and kill them all for the command line in linux.

To find all the processes ids for a particular app you can use the following:

Find all the processes for a particular app

ps -d | grep app_name | awk '{print $1}'

For example to find all the processes for visual studio code (process name is code, you would type

ps -d | grep code | awk '{print $1}'

Kill all the processes for that particular app

If you want to kill all those processes, just prepend kill and use the ids as arguments

kill $(ps -d | grep code | awk '{print $1}')

References

Business Toolkits for Innovation, Management, and Solving Problems

/images/business-toolkits-for-innovation-management-and-solving-problems.jpg

There are many good and bad concepts, areas, books, methodologies and tools in the business world and, after a while, one starts to forget them. Among those, some of which I find useful and/ or interesting are:

  • Innovation,

  • Marketing,

  • Digital Marketing,

  • Market Research,

  • Business Strategy,

  • Blue Ocean Strategy,

  • Six Thinking Hats,

  • ReWork,

  • Business Model Canvas.

Sometimes some of these toolkits are really hard to understand and use, while others give you moments like "How didn't I think of this before!".

Whichever the case, there are those which one should at least know of to be able to speak the same language as others in the industry.

"If the only tool you have is a hammer, it is tempting to treat everything as if it were a nail."

Law of the instrument - Abraham Maslow

I'm also a hard believer of the "Law of the instrument" by Abraham Maslow which states, paraphrasing, "if you have just a hammer, everything looks like a nail", so I try to add items to my mental repository (and my notes) regularly.

That said, it is important to highlight that there are some of these toolkits that are designed for early-stage projects, others for startups raising investment and many more for big companies which have to develop its business and improve daily.

Each of these toolkits assumes particular situations and paradigms and were developed to support people and businesses in those situations. If you want to apply them to other situations and paradigms, you have to put the required additional effort to understand and adapt the toolkit.

If you don't understand under which paradigms a toolkit was developed, you are likely to try to apply it in a less-than-adequate way, which may complicate things instead of simplifying them.

Some evolved to be applied to other areas or industries (such as Lean Manufacturing), while others were simply designed for specific use-cases. Some are multi-faceted and multi-situational toolkits and deliver or explain ways of thinking and approaching problems (e.g. market research methodology or the 6 Thinking Hats), while others describe a series of steps to obtain a particular result (e.g. the Business Model Canvas gives an overview of a project/ business at one point in time). If you don't understand under which paradigms a toolkit was developed, you are likely to try to apply it in a less-than-adequate way, which may complicate things instead of simplifying them.

You can of course mix them and use whatever you want from each of them (which is what I always recommend), but for that, you have to first:

  1. know they exist and,

  2. understand them so that you can adapt the useful parts for your use-case.

Introducing new business toolkits into a team (or organization)

When trying a new toolkit in an organization or in your team, there will always be those in favor and those against it. Don't take it personally. If you want to try a new toolkit it is part of your job to understand why it could not work or why could not apply and also your responsibility to not use the toolkit if it makes more problems than those it solves.

Given that there are almost always other people involved, chances are you will have a situation where there is a strong opposition. There are many reasons why this would be the case, and I will try to list those which I have found, by my experience, to be critical when I have tried to introduce a new toolkit:

  1. You are working with people who hate business and marketing. This is more normal and less discussed than you think. There are many which see the whole business world as work for someone else. I've seen this mostly with hardcore engineers, or some really technical people, This is not bad at all if you understand this before trying to implement a new tool or methodology. The opposite is also true and for some (most) business people all technology-related stuff is not their problem)

  2. The company you are working for/ with has a way which has always been there, which means there is a strong opposition to anything which doesn't align with the *normal way of doing stuff*.

  3. No one has time to learn yet another tool or methodology, especially if the normal way "works".

  4. You are getting into the area or work of someone else without speaking with them first. They may or may not understand what you are trying to use or what you are endeavoring to achieve. In this case, bringing them into the project at the beginning and consulting with them how this new toolkit might improve things works wonders.

  5. You are trying to do something no one asked you for. Yes, sometimes you just get the (inner)call to fix or improve something, or you just like to swim against the flow.

I've found that knowing and using these toolkits has helped me get things done (on projects, endeavors, and daily work), and I'm always trying to add (learn) new toolkits to my repository and modify/ mix methodologies and tools.

This article is the first from a series of articles (or at least I hope so) where I will try to summarize and explain such tools and methodologies along with some of my personal notes. Why? Because it helps me remember them and because I like to :smiley:

Here is a list of the articles I'm planning to write or already written. If there is any toolkit I missed, please let me know.

Other articles of this series:

And these are the articles I plan to write:

  • SRI's 5 disciplines of Innovation

  • Blue Ocean Strategy

  • Business Model Canvas

  • 6 Thinking Hats

  • Nudge (book)

  • Market research methodologies

  • Design Thinking

  • How to do meetings (according to my experience)

  • Diffusion of innovations (by Everett Rogers) and how it impacts you.

  • Productivity tools and methodologies: a review and comparison according to my experience

  • The art of innovation (by Guy Kawasaki)

  • Getting things done and Zen to do

  • Elevator Pitch

  • The 5 Stages of Customer Awareness and its impact in marketing

  • Love marks

  • Making Ideas Happen

What is Git (version control system) and why you need to use it for your projects (any project with files and content, not just code)

When you work on something for more than a couple of hours and across several days or months, you are bound to try new things, ways of writing, code, images and so on. And while doing so, you will probably start creating many files with different names for the same content so that you can have versions, such as Text-1.txt, texts-1-1.txt, project-a-final.docx, project-a-final-2.docx, and so on. If you have a more structured mindset you may even use a time stamp on your file names in the form of project-a-2022-11-12-1211.docx or similar. After a couple of tries, you have tens or even hundreds of files and you won’t even know which one was the correct one. This gets even more complicated if you also want to collaborate with others (and not depend on Google Docs (or similar) or if your project cannot be done in such tools).

Here comes a version control system (aka as VCS) to help. Instead of manually creating files and giving them a name, saving them somewhere and tying to find out which one you really wanted to use, or which parts of which files, you my as well use a vcs, in this case git, to manage the whole thing. If you use it the right way, you will even have a nice history of your changes.

A VCS, also sometimes known as a SCM (source code management) or RCS (revision construal system) is a system which tracks changes to a file or a set o files. Usually, developers use a VCS to track changes to code and collaborate with others, but software development is not the only use case.

Types of version control systems

There are several kinds of VCS’s, and they are categorized in centralized and distributed.

Centralized VCS

A centralized VCS works on a client-server model, where a centralized master code base is in a server, and a developer or collaborator can lock (check-out) a piece of this code (version) and work on it. In this case everything is controlled by the server.

The best known examples are CVS and Subversion (open source) and IBM ClearCase (commercial).

Distributed VCS

A distributed VCS works on a peer-to-peer model, where a code are or project is distributed among the individual developer’s devices and the entire history as well as the versions are mirrored on each system.

In this case the emphasis is on changes instead of versions, so that any version (branch) is a combination of many sets of changes (commits).

The main examples here are Git and Mercurial.

In fact the slogan from git is everything is local, high emphasizes the distributed part.

Git (the system we will use)

We will discuss Git, which is a distributed version control system.

Git (/ɡɪt/)[8] is free and open source software for distributed version control: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. -Wikipedia

What is git in simple words?

Git is a version control system (VCS) which allows you to track changes to a file or set of files over time.

In other words, Git is a tool or system that allows you to add files to a tracked repository (a folder which was initialized or configured as a Git Repository), commit changes to the repository with a message stating which changes were made and, optionally, push those changes to a centralized server to collaborate with others and pull them to get the changes others made.

Within this repository you can have different branches (as the branches of a tree), each of which can have a specific version (combination of changes) of a file or set of files. This means you can have a main or master branch (think of this as the tree trunk) from which several branches (or none) can grow (or be created).

The commits and its messages build the log, journal or history of a repository and each of its branches.

Usually what you want is to have as little branches as possible, and as many branches as projects, ideas or issues in which you are working on.

You can think of it like the branches of a bush or garden tree. The more the branches grow and in more directions, the more complicated it is to prune the tree and maintain a shape. The same goes for repositories. The more branches you have the more the branches differ from each other, making it more complicated to get back to the master branch.

Each branch will grow or stagnate independently, and the way to get the changes from one branch to another is to merge them. You usually merge two branches using a merge request, where you can check the differences and changes to each file between two branches.

Once you are ok with the merge request you can approve the merge, meaning you will mix (merge) the content of each file into a new version of the file on the destination branch (usually master or develop) or reject the merge request (aka MR) and just discard the changes. You may even remove the whole branch or leave it there for historic purpose.

Use cases

As explained before, a vcs is a way to track files (not only code) and you can use it for almost anything (videos and really big files might be a bad idea though, although there is a solution for that called Git Large File Storage or Git LFS).

I have used git to track the changes of several books written in markdown and asciidoc, this site (written in markdown, restructured text and python), as well as personal and professional programming projects, notes and even be used as an alternative to Dropbox (check git-annex. There are ways for designers to use git to track changes to designs, parsers for office files, and many others.

The main point here is that git is not only for tracking code.

How to use Git

You may use git on the command line, a desktop graphical user interface or a web-based management platform. There are several to choose from, but the most popular ones are:

  • GitHub (saas, now part of Microsoft)
  • GitLab (saas and open source)
  • Gitea (open source, self-hosted)
  • Codeberg (gitea as non-profit saas, backed by non-profit Codeberg e.V. in Germany)
  • BitBucket (commercial)

The web-based management platforms also add several features which are not part of git (or any vcs) but are really useful (mostly for software projects but also for other kinds of projects).

For example they usually include:

  • Issue tracking (integrated with git)
  • Continuous Development/ Continuous Integration
  • Merge request and comments
  • Approval or rejection of merge requests
  • ACLs or access control lists for repositories based on roles and permissions
  • A web editor for code with syntax-highlighting

Depending on which system you use to create and manage your repository the way to do the same may differ and the tool itself is really flexible.

Important: You don’t need any web platform to use git, as it can run completely local.

Git on the command line

There are many commands in git, but with the following you can get started:

# initialize a repository (folder)
git init

# add files for the repository
git add file

# add all files in this folder to the repository
git add .

# commit changes for the added files
git commit -m “short message describing the changes”

Git on GitHub

Go to https://github.com and create a new account to get started.

Git on GitHub

Go to https://gitlab.com an create a new account to get started.

Git workflow: GitFlow

There are many ways of using git (workflows or branching strategies) which one could follow but the most popular ones are

There are already excellent comparisons which you can refer to if you want to learn more. (Check https://www.devbridge.com/articles/branching-strategies-git-flow-vs-trunk-based-development/ and https://www.flagship.io/git-branching-strategies/.

I personally use Git-Flow.

Article updates

  • 2022-12-23: added links for git web platforms, added syntax highlighting for bash and links for git workflows and social share image