Archive for October, 2018

grep something and show the surrounding lines too

October 24, 2018 Leave a comment

You grep a pattern but you also want to see the lines before and after.


$ cat file.txt | grep -C 1 pattern

It will also show one line before and one line after.

Categories: bash Tags:

[Nim] A URL shortener command-line app.

October 23, 2018 Leave a comment

This afternoon I wrote a URL shortener command-line application in Nim. It uses the URL shortener service.

You can find the project here: .

Categories: nim Tags: , , ,

[Nim] cross-compile under Linux to Windows

October 23, 2018 1 comment

You are under Linux, and you can produce an executable binary with the Nim compiler. However, you would like to produce a Windows EXE too. We want to stay under Linux and we want to produce the EXE on Linux. How to do that?

On Manjaro, I had to install this package:

$ yaourt -S mingw-w64-gcc-bin

It’s a cross-compiler that we’ll use for producing the EXE.

Let’s take a simple Nim source (hello.nim):

echo "hello windows"

Now cross-compile it:

$ nim --os:windows --cpu:amd64 --gcc.exe:x86_64-w64-mingw32-gcc --gcc.linkerexe:x86_64-w64-mingw32-gcc -d:release c hello.nim

And you get hello.exe .

$ file hello.exe
hello.exe: PE32+ executable (console) x86-64, for MS Windows

If you copy it on a Windows system, you can run it there without any problem. Or, you can also run it under Linux with wine :)

$ wine hello.exe
hello windows

I found this idea in the following blog post: Writing a 2D Platform Game in Nim with SDL2.

Update (20181028)
I found info about it in the official docs too:

browse your fonts easily

October 13, 2018 Leave a comment

I wanted to create a captioned image with Gimp and for this I was looking for a nice font. Under Manjaro I installed the package “aur/ttf-google-fonts-opinionated-git” and thus I got hundreds of fonts. How to visualize and browse them easily?

FontManager can do exactly this. Install the package “aur/” and launch the app. with the command FontManager. It looks similar to this:

On the left side click on a font, then use the down arrow to run through the fonts.

Categories: linux, manjaro Tags: , , ,

maximize a window

October 13, 2018 Leave a comment

In Manjaro (XFCE) it’s “Alt+F10”. In Windows it’s “Super key + up arrow”.

In Manjaro, you can find and edit all window manager shortcut keys from Menu → Settings Manager → Window Manager → Keyboard tab.

Originally, I wanted to figure out how to maximize a VS Code window (reddit question here).

moved from KeePassX to KeePassXC

October 13, 2018 Leave a comment

KeePassX served me very well in the last few years. It’s a password manager that keeps your usernames / passwords in an encrypted file and you only need to memorize just one master password.

KeePassXC is the community edition of KeePassX. From its FAQ: “KeePassX is an amazing password manager, but hasn’t seen much active development for quite a while. Many good pull requests were never merged and the original project is missing some features which users can expect from a modern password manager. Hence, we decided to fork KeePassX to continue its development and provide you with everything you love about KeePassX plus many new features and bugfixes.

I tried it and it could open my .kdbx database file without any problem. It has some nice changes compared to KeePassX so I think I’ll use this newer and fresher version. Just like KeePassX, it runs under Linux and Windows too.

URL redirector for your browser

October 13, 2018 Leave a comment

I don’t really like the new design of Reddit. Fortunately, you can still visit the old version at the URL Sometimes I get to and then I need to rewrite the URL to How to automate the process?

I found an extension for this called Redirector. The Reddit problem was solved with this rule:



Categories: firefox Tags: , ,

[nim] NimPyKot: my first Nim library

October 12, 2018 Leave a comment

I started to play with the Nim programming language two weeks ago. I really love it. My favorite language is Python and it’s so similar to Python that I could feel at home right from the beginning. It’s like a compiled Python :)

As I missed some Python / Kotlin features, I decided to create a library. It’s called NimPyKot and it’s installable with nimble, the package manager of Nim. It’s a work in progress, but it’s already usable.

Categories: nim Tags: , , ,

57 Raspberry Pi commands that everyone should know

October 9, 2018 Leave a comment

See . They are mainly Unix commands, thus they are not specific to Raspberry Pi.


  • Files management
  • Network commands
  • System updates
  • Packages management
  • System management
  • Raspbian commands
  • Misc commands
  • Warrior commands
Categories: linux Tags: , , , , ,