uniq_

setup vim autocompletion (on debian 10)

I think youcomplteme is a great autocompletion addon for vim. It's simple but effecite. It's also packaged for debian.

sudo apt install vim-addon-manager vim-youcompleteme python3-future
vam install youcompleteme
echo 'let g:ycm_global_ycm_extra_conf = "/usr/lib/ycmd/ycm_extra_conf.py"' >> ~/.vimrc
echo 'filetype on' >> ~/.vimrc

That's it. I've been using this for years and I'm quite happy with it.

Note: python3-future is required as a workaround, because debian ships a old version of youcompleteme. When you're developing python and use virtual-env, this can hide the future module form you path. This then triggers the previously mentioned bug. vim will prompt YouCompleteMe unavailable: No module named 'future' on startup. An easy mitigation is to just install that moduel to your venvs too, eg. with: python3 -m pip install future.

Semantic versioning

I think it's funny how version numbering actually is a engineering technique for avoiding incompatibilities, but made it's way to popular culture. I guess it's hard to escape hearing about Web 2.0, Industry 4.0, or whatever. Thou isn't Web 2.0 already a thing of the past?

Anyway version numbering actually is an great engineering tool. Especially when done right. So here's how it's supposed to work:

https://semver.org

I wonder why this never was topic at school/university for me.

Reproducible Builds Manifesto

I occasionally encounter people who never heard about reproducible builds before. Since this is a very important technique I thought I should share the link.

https://reproducible-builds.org

It's basically a technique for making sure software was not tampered with. Overall I think every piece of software should be built reproducibly, especially infrastructure like libraries, operating systems, app-stores etc...

Keep a Changelog dot com

Sometimes it's helpful reading through a changelog. Not may projects keep one. Often enough they're not well kept either. Today I stumbled upon a nice guide for structuring changelogs, I really hope this becomes an industry standard:

https://keepachangelog.com

su was weird today

I can't login into some accounts on some of my GNU/Linux systems. eg. Because some of them are service accounts with no login shell, or simply because it's impolite logging-in to other peoples accounts.

But I needed to know whether one specific account was member of a group. Using sudo that's trivial.

sudo -u $USERNAME groups

Using su thou requires to also specify -p (aka. --preserve-environment).

su $USERNAME -p -c groups

Not hard either, but a bit unintuitive, especially when the error message just says: This account is currently not available.

use htop to inspect disk loads

Though iotop is very useful, I was made aware that htop also has support for displaying IO meters. Here's how to add such a column:

  1. Start htop
  2. press F2
  3. go to Columns
  4. select IO_RATE from available columns

There are a couple of other interesting columns in there as well. Definitely worth a look.

Run software with graphic ui using sudo on Debian 9

Sometimes it's necessary to run software as root. For example when running KVM for booting a local hard drive, flash drive, sd-card etc.

# allow kvm to open a window while running as root
xhost +si:localuser:root

Getting TLS certs with lets encrypt (certbot) for a Debian 9 (Stretch) Server running Nginx

I needed to get TLS certs with lets encrypt for a Debian 9 (Stretch) with nginx web-server.

It's super easy to get TLS certificates with certbot. Please note that there are several ways to do a ACME verification. Using apache looks similar to using nginx. There's also a standalone server built into certbot should you have no http server running.

# install required packages
sudo apt install certbot python-cerbot-nginx

# get certificates
# use the fqdn (full qualified domain name) of the machine you're running
# this on instead or example.com. Also supply a mail address for
# notifications from lets encrypt instead of hostmaster@example.com
sudo certbot certonly --agree-tos --nginx -d example.com -m hostmaster@example.com

# add cronjob for renewing certs
sudo bash -c '(crontab -l; echo "@daily certbot renew --quiet") | crontab -'

That's it. Go ahead and take a look at your certificates.

sudo ls -l /etc/letsencrypt/live

sources: