Archive for November, 2018

You can open a markdown (.md) file in Okular

November 29, 2018 Leave a comment

Today I found out by accident that you can open a markdown file (.md) with okular. okular was just a PDF viewer for me. The .md file is nicely rendered and you can convert it to PDF or you can print it. Awesome!

Categories: linux Tags: , , , ,

[shell] How to tell your distro version?

November 28, 2018 Leave a comment

I use two different Linux distros, Ubuntu and Manjaro. Both of them are great. My shell resource files (previously .bashrc, now .zshrc) are shared via Dropbox. However, sometimes I would like to differentiate my Ubuntu and Manjaro settings, within the same resource file. How to do that?

Here is what I use:

# DESKTOP_SESSION is "ubuntu" (for Ubuntu) or "xfce" (for Manjaro)
if [[ "$DESKTOP_SESSION" == "ubuntu" ]]; then
  alias files='dpkg-query -L'
  alias files='pacman -Ql'

Older solution
Before finding the environment variable DESKTOP_SESSION, I used this:

# return "ubuntu", "manjaro" (without quotes)
get_distro_name() {
  cat /etc/os-release | grep "^ID=" | cut -d= -f2

# usage:
# if [[ $(get_distro_name) == "ubuntu" ]]; then
#   alias files='dpkg-query -L'    # ubuntu
# else
#   alias files='pacman -Ql'       # manjaro
# fi
Categories: shell Tags: , , , , ,

Steam client on Ubuntu 18.04

November 26, 2018 Leave a comment

Steam stopped working. At the end of an update process it complained that “” was missing.

I found the solution here. In short:

First, delete steam:

sudo apt remove steam

Execute this:

sudo dpkg --add-architecture i386

Restart the machine. Then, install these packages:

sudo apt-get install wget gdebi libgl1-mesa-dri:i386 libgl1-mesa-glx:i386 libc6:i386

Download the steam package:


And install it:

sudo gdebi steam.deb

After this, steam started normally for me.

Hero of the Kingdom 2 patch
The game “Hero of the Kingdom 2” didn’t want to start. I got the error “access violation”. I found the remedy here.

It seems this problem is related to the Intel driver. I have an integrated Intel video card.

The solution in short: download the driver , extract it, and replace the file /usr/lib/i386-linux-gnu/dri/ with the one from the archive. Of course, don’t forget to make a backup of the original file.

[nim] using the xterm-256 colors in the terminal

November 25, 2018 Leave a comment

Most terminals support the xterm-256 extension, which allows you to use 256 colors in your terminal. But how to use these colors from Nim?

See for a demo. Screenshot: here.

I found the original ZSH version here. I took this code and rewrote it in Nim.

Categories: linux, terminal Tags: , , ,

number of lines and columns of your terminal

November 16, 2018 Leave a comment
$ tput lines
$ tput cols

Of course, the values depend on your own settings.

I found it in the script, which adds snowflakes to your terminal. Really cool.

Related animated short film: Operation White Widow (2011).

In Nim, there are functions for these in the module terminal. See terminalWidth and terminalHeight.