Master file

Day 864

zsh bracketed paste (don’t run command in terminal when pasting)

Stop terminal auto executing when pasting a command - Ask Ubuntu:

  • If you copy a newline symbol at the end of whatever you are copying, it gets executed as expected
  • bracketed paste (enabled by default on zsh) disables this behaviour

Had unset zle_bracketed_paste in zsh config, likely needed for athame that I don’t use. Removed it, works now.

To enable in bash,

echo "set enable-bracketed-paste" >> .inputrc

I should make an eventual list of dotfiles I use for all remote servers, this will go there 100%.

Docker COPY copies contents, not directory

Docker COPY copies contents, not directory
Docker COPY copies contents, not directory
Docker COPY copies contents, not directory
Docker COPY copies contents, not directory \

kitty hint for IPs + python non-capturing (unnamed?) groups

Added these to kitty config! One for IPs, second IPs+ports:

map kitty_mod+n>i kitten hints --type regex --regex [0-9]+(?:\.[0-9]+){3} --program @
map kitty_mod+n>p kitten hints --type regex --regex [0-9]+(?:\.[0-9]+){3}:[0-9]+ --program @

Glad I can still read and understand regexes. The above highlight more than needed, but seems to be kitty’s problem.

In python, a group without ?: is a non-capturing group in python (= not returned in .groups()). In kitty (that uses python syntax), only what’s inside the first capturing group is copied; making it non-capturing makes it copy the entire regex. 1

Day 863

Remapping a Thinkpad T580 Fn key to Ctrl

The location of the Fn key on the laptop keyboard is absolutely idiotic and I hate it. Fn keys are usually handled by the hardware and ergo unusable. Now that I have to use the keyboard more, thought I have nothing to lose and tried xev and oh what a wonderful world it gets read as XF86WakeUp! Therefore it can be remapped to something more sensible. … like the Ctrl key it should be.

Easiest way for me was adding this to autostart:

xcape -e 'XF86WakeUp=Control_L' -d &

No side effects of the other xcape command xcape -e 'Control_L=Escape' -t 100, it seems to be considered a different Control_L key and clicking it fast doesn’t produce Escape.

Day 862

Disable touchpad

xinput set-prop 13 340 1, where 13 comes from xinput -list

Dockefile RUN a lot of commands

It’s possible to do this instead of prefixing each command with RUN:

RUN apt-get update && \
    # install base packages
    apt-get install -y -qq apt-utils aptitude wget curl zip unzip sudo kmod git && \
    /usr/bin/python3 -m pip install --upgrade pip && \

Day 861

kitty hints

Changed the hint I most often use to a better binding:

# Copy url
# map kitty_mod+n>c kitten hints --type path --program @
map kitty_mod+g kitten hints --type path --program @


  • w track 1728 tag1 automatically ends it now`.
  • w continue just continues the last thing running by starting something identical starting “now” and continuing till stopped.

kitty kittens

kitty autocompletion

In zshrc:

autoload -Uz compinit
# Completion for kitty
kitty + complete setup zsh | source /dev/stdin

kitty scrollback pager

From Feature Request: Ability to select text with the keyboard (vim-like) · Issue #719 · kovidgoyal/kitty · GitHub:

scrollback_pager vim - -c 'w! /tmp/kitty_scrollback' -c 'term ++curwin cat /tmp/kitty_scrollback'

Vim 8.0 works. Nice colorful etc.

zsh vim mode timeout

Zsh Vi Mode:

Adding this allows to register the <Esc> key in 0.1 sec, not default 0.4.


A good documented vimrc

A Good Vimrc - TODO

I also love his design!

zsh vim mode with objects!

GitHub - softmoth/zsh-vim-mode: Friendly bindings for ZSH’s vi mode

Out of all the various vim plugins, this is the only one I found that allows to meaningfully work with objects, like ci' etc. Also the mode indicator works very reliably.

Doesn’t conflict with zsh-evil-registers.

English / random

  • “expect and require”

Day 860

Qutebrowser crashing - again

Ubuntu 18.04, qutebrowser etc, as usual. What helped was creating the environment with these options:

python3 scripts/ --pyqt-version 5.14

jq | less zsh alias

Should’ve done this a long time ago:

lq() {
    jq . "$1" -C | less

kitty terminal copy url

From config; I should use them more.

# Select a filename and copy it 
map kitty_mod+p>c kitten hints --type path --program @
#: Select a path/filename and open it with the default open program.
map kitty_mod+p>o kitten hints --type line --program -

update-alternatives & installing another gcc

Nicely described: How to switch between multiple GCC and G++ compiler versions on Ubuntu 20.04 LTS Focal Fossa -

# install stuff
$ sudo apt -y install gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9
# Add it to update-alternatives
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9

# choose the default one
$ sudo update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path            Priority   Status
  0            /usr/bin/gcc-9   9         auto mode
  1            /usr/bin/gcc-7   7         manual mode
* 2            /usr/bin/gcc-8   8         manual mode
  3            /usr/bin/gcc-9   9         manual mode
Press  to keep the current choice[*], or type selection number:

From the docs: --install link name path priority

Python pip

Editable installations (pip install -e .) are a thing. TODO - learn more about them.

Qutebrowser config - adding bindings for tabs 20-30

Given that the standard ones are not enough for me, and even my additional ones for 10-20 are not enough, added a third level:

config.bind('1', 'tab-focus 1')
config.bind('2', 'tab-focus 2')
config.bind('3', 'tab-focus 3')
config.bind('4', 'tab-focus 4')
config.bind('5', 'tab-focus 5')
config.bind('6', 'tab-focus 6')
config.bind('7', 'tab-focus 7')
config.bind('8', 'tab-focus 8')
config.bind('9', 'tab-focus 9')
config.bind('0', 'tab-focus 10')
config.bind('<Alt-1>', 'tab-focus 11')
config.bind('<Alt-2>', 'tab-focus 12')
config.bind('<Alt-3>', 'tab-focus 13')
config.bind('<Alt-4>', 'tab-focus 14')
config.bind('<Alt-5>', 'tab-focus 15')
config.bind('<Alt-6>', 'tab-focus 16')
config.bind('<Alt-7>', 'tab-focus 17')
config.bind('<Alt-8>', 'tab-focus 18')
config.bind('<Alt-9>', 'tab-focus 19')
config.bind('<Alt-0>', 'tab-focus 20')
config.bind('<Alt-Ctrl-1>', 'tab-focus 21')
config.bind('<Alt-Ctrl-2>', 'tab-focus 22')
config.bind('<Alt-Ctrl-3>', 'tab-focus 23')
config.bind('<Alt-Ctrl-4>', 'tab-focus 24')
config.bind('<Alt-Ctrl-5>', 'tab-focus 25')
config.bind('<Alt-Ctrl-6>', 'tab-focus 26')
config.bind('<Alt-Ctrl-7>', 'tab-focus 27')
config.bind('<Alt-Ctrl-8>', 'tab-focus 28')
config.bind('<Alt-Ctrl-9>', 'tab-focus 29')
config.bind('<Alt-Ctrl-0>', 'tab-focus -1')

EDIT: Actually, to think of it, in for a penny, in for a pound!

for i in range(30, 60):
    config.bind(','+str(i), 'tab-focus '+str(i))

Takes about 9 seconds to :config-source everything, but then works like a charm! And doesn’t seem to make anything else slower (strangely, even startup is as usual).

pycharm can parse markdown!

Opened a, and see it being rendered nicely to the left. I can also edit it directly. Wow.

Website with references / cheat sheets for a lot of CLI programs

sed Cheat Sheet - very down-to-earth, “praxisnah”, I like it. Except for the idiotic scrolling override animations

jq basics - again

jq Cheat Sheet

  • I should use ' for the filter, " for any string elements inside it

  • select
    • Get full record if it matches something
    • jq '.results[] | select(.name == "John") | {age}' # Get age for 'John'
  • Value VS key-value
    • jq '.something' gets the content of fields something removing the key
    • jq '. | {something}' gets key-value of something
    • Sample:
      $ jq '. | select(.tokens[0]=="Tel") | .tokens[]' mvs.json
      $ jq '. | select(.tokens[0]=="Tel") | .tokens' mvs.json
      $ jq '. | select(.tokens[0]=="Tel") | {tokens}' mvs.json
      "tokens": [
  • |keys to extract keys only

jq Cheet Sheet · GitHub also nice TIl that you don’t need jq '. | keys', jq 'keys' etc is enough.

  • `‘del(.tokens)’ to delete a key
  • Indexing works like in Python, say jq '.[-2:]'
  • 'sort_by(.foo)'

I think now I’m ready for the holy of holies: jq 1.4 Manual

  • {user, title: .titles[]} will return an array of {user, title} for each value inside .titles[]!
  • Putting ()s around an expression means it’ll be evaluated. {(.user): .titles} will use the value of the key user!
    $  jq '. | {(.id): .id}' mvs.json
    "7574": "7574"
  • Putting values inside strings with \(foo)
    $ echo "[1,2,3]" | jq '"A string \(.)"'
    "A string [1,2,3]"

    It’s basically synonymous to python3’s f"My f-{string}"

  • '.a=23' will produce an output with .a being set to 23. Will be created if not there.
    • No “change” is being done, the actual value is the same; .a in the same filter after a comma will still return the old value.
  • |= will “update” the value by running its previous value through the expression:
    $ echo '{"one": 23,"two":2}' | jq '.one|=(. | tostring)'
    "one": "23",
    "two": 2
  • slurp mode - instead of returning objects, return a list of objects! For more ‘correct’ json.

Python JSON parser + jq compact mode

It didn’t read the jq-generated multi-line output without commas between items, but jq compact mode does one record (without comma and not as part of an array) per line, and this gets parsed correctly!

JQ compact mode is jq -c '.' sth.json


  "id": "7575",
  "ner_tags": [
  "tokens": [



Linux - creating a directory accessible to multiple users via a group

How to Create a Shared Directory for All Users in Linux

# Create the group
$sudo groupadd project 
# Add user to this group
$sudo usermod -a -G project theuser
# Change the group of the directory
$ sudo chgrp -R project /var/www/reports/
# Turn on the `setGID` bit, so newly created subfiles inherit the same group as the directory
# And rwxrwx-rx
$ sudo chmod -R 2775 /var/www/reports/

Day 856

Presenting stuff

“Which story do you want to tell?” (Heard at work, from R)

Git get commit message from file

git commit -F filename allows to use a pre-written commit message from a textfile.

Day 855

i3 scratchpads magic!

You can ‘mark’ windows1, a la vim, and then use that as filter - no window classes etc needed - for example, for scratchpads!2

So now I have two scratchpads in i3 config:

bindsym $ms+Shift+plus mark "scratch2", move scratchpad
bindsym $ms+plus [con_mark="scratch2"]  scratchpad show

bindsym $ms+Shift+minus mark "scratch", move scratchpad
bindsym $ms+minus [con_mark="scratch"]  scratchpad show

The second one originally was meant to be for Ding, but it’s really nice to have it flexible.

Day 854


Reading “German: An Essential Grammar” by Donaldson found this bit: 1

English has a rule that if the time of an event that \ occurred in the past is mentioned, then the imperfect must be used, but if \ the time is omitted, the perfect is required, e.g. \

  • He returned from Hamburg yesterday.
  • He has returned from Hamburg.
  • He has returned from Hamburg yesterday. (not grammatical)


zsh detach and disown

zsh-specific - to detach & disown a process, there’s &!: 2

dolphin &!

German / Deutsch

Long question and answer about fahren zu/nach/in/…: Richtungen und Ziele

German FSI language courses

The Yojik Website has the FSI courses FSI Languages Courses and the website as I remember it.


Changed ~/.taskrc to show any active tasks regardless of anything else in my sprint view:

s () {task s \(project:w or \(sprint:$SPRINT \(+A or +O\)\) or +ACTIVE\) "$*"}

Turn off screen/monitor with xset

Standard lock command leaves both monitors on.

Reddit3 mentioned two commands:

xset s activate
xset dpms force off

The second one worked for me!

Now I have shiny new screen lock (and suspend too, while we are at it) keybinding in i3 config!

bindsym $ms+n exec gnome-screensaver-command -l && xset dpms force off
bindsym $ms+Shift+n exec i3lock -i ~/s/black_lock.png -t -p win -e && systemctl suspend -i

Day 853

Nvidia Docker images

Nvidia has a repo of all docker images it creates, one of them: Torch | NVIDIA NGC


“Das finde ich zielführender als…” - heard at work

Docker - automatically assign a free port

docker run --name frontend -p 0:80 frontend:latest1

Port 0 gets passed to the kernel that assigns any free port.

To see which one, docker port somecontainer.

Docker run container on specific GPU

docker run --gpus device=3 -e NVIDIA_VISIBLE_DEVICES=0 -e CUDA_VISIBLE_DEVICES=0 myservice

Where the device=3 is the GPU id on the host that we want to use.

Day 850

grep ignore case

lspci | grep -i "nvidia"

-i == ‘ignore case’ is actually something that I can remember.

Docker (stop) autostart of container

Docker will autostart any container with a RestartPolicy of ‘always’ when the docker service initially starts. 1

I can set/unset it in kitematic, or through terminal:

docker update --restart=no my-container

apt-get purge remove –autoremove etc

Quoting SO: 2

    apt purge --auto-remove <packagename>

purges packagename and any packages which are rendered unnecessary by its removal, as well as any other packages which aren’t necessary.

    apt autoremove --purge

purges any packages which aren’t necessary (marked as “automatically installed” and with no dependent packages).

The first form is what you’d use when manipulating individual packages; the latter is a clean-up operation across all packages.

Ways to clean up with apt-get - tutorial

This seems nice, TODO: Cleaning up with apt-get | Network World

Backing up LVM disk encryption keys

LVM - Debian Wiki is nice and readable. I used this command to backup the headers:

 sudo cryptsetup luksHeaderBackup /dev/nvmeXXXXX   --header-backup-file headerBackupFile

… and put it somewhere not on the drive I’ll be recovering if it all goes wrong.

Setting up Tensorflow and CUDA with an eGPU

Aaaand the saga continues!

…since the GPU is an eGPU, apparently I do need to do the harder way: Accelerating Machine Learning on a Linux Laptop with an External GPU | NVIDIA Developer Blog

Getting the eGPU detected

It is, I can see it:

(17:42:42/10815)~/$ lspci | grep -i VGA
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
0c:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)

but if it wasn’t, I’d authorize it and check with boltctl list:

(17:43:13/10817)~/$ boltctl list
   ├─ type:          peripheral
   ├─ name:          GV-N1070IXEB-8GD
   ├─ vendor:        GIGABYTE
   ├─ uuid:          # redacted
   ├─ status:        authorized
   │  ├─ domain:     domain0
   │  └─ authflags:  none
   ├─ authorized:    Do 29 Apr 2021 07:57:37 UTC
   ├─ connected:     Do 29 Apr 2021 07:57:37 UTC
   └─ stored:        no

How to setup an eGPU on Ubuntu for TensorFlow describes other things that can go wrong:

I had to disable the following, otherwise my eGPU was not detected:

  • Secure Boot
  • Thunderbolt Security Level

From this point on, I follow Nvidia’s tutorial 3 unless stated otherwise.

Purging, cleaning up old broken install attempts, updating and upgrading

Using quotes means the * doesn’t have to be escaped.

sudo apt-get purge "nvidia*"

This is a fuller example: 4

sudo rm /etc/apt/sources.list.d/cuda*
sudo apt remove --autoremove nvidia-cuda-toolkit
sudo apt remove --autoremove nvidia-*

Found and manually removed /etc/apt/sources.list.d/graphics-drivers-ubuntu-ppa-bionic.list, leaving the .save file in place.

As per nvidia’s guide,

sudo apt-get update
sudo apt-get dist-upgrade

To be safe, rebooted.

Downloading the correct drivers

The existing driver is most likely Nouveau, an open-source driver for NVIDIA GPUs. Because Nouveau doesn’t support eGPU setups, install the NVIDIA CUDA and NVIDIA drivers instead. You must also stop the kernel from loading Nouveau. 3


Change of plan - what is NVIDIA data-science-stack?

Found this: NVIDIA/data-science-stack: NVIDIA Data Science stack tools Read about it here: Ubuntu for machine learning with NVIDIA RAPIDS in 10 min | Ubuntu

Official by nvidia, and seems to do automatically what’s needed for supported systems. Let’s run a script from the internet that installs drivers, loads kernel modules etc.

Source is available, yay for open source: data-science-stack/data-science-stack at master · NVIDIA/data-science-stack

Ran ./data-science-stack setup-system - uses sudo, didn’t ask for root or anything.o

Seems to have installed nvidia driver version 460. Asked to reboot at the end.


(18:40:30/10909)~/$ nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

okay. Same results I had. Confirms that my prev. steps weren’t wronger than the script.

(18:41:49/10910)~/$ sudo apt list --installed | grep "\(cuda\|nvidia\)"

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libnccl2/unknown,now 2.9.6-1+cuda11.3 amd64 [installed]
libnvidia-cfg1-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
libnvidia-common-460/unknown,now 460.73.01-0ubuntu1 all [installed,automatic]
libnvidia-compute-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
libnvidia-container-tools/bionic,now 1.4.0-1 amd64 [installed,automatic]
libnvidia-container1/bionic,now 1.4.0-1 amd64 [installed,automatic]
libnvidia-decode-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
libnvidia-encode-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
libnvidia-extra-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
libnvidia-fbc1-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
libnvidia-gl-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
libnvidia-ifr1-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
nvidia-compute-utils-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
nvidia-container-runtime/bionic,now 3.5.0-1 amd64 [installed,automatic]
nvidia-container-toolkit/bionic,now 1.5.0-1 amd64 [installed,automatic]
nvidia-dkms-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
nvidia-docker2/bionic,now 2.6.0-1 all [installed]
nvidia-driver-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed]
nvidia-kernel-common-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
nvidia-kernel-source-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
nvidia-prime/bionic-updates,bionic-updates,now 0.8.16~ all [installed,automatic]
nvidia-settings/unknown,unknown,now 465.19.01-0ubuntu1 amd64 [installed,automatic]
nvidia-utils-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]
xserver-xorg-video-nvidia-460/unknown,now 460.73.01-0ubuntu1 amd64 [installed,automatic]

Also, as usual,

(18:48:34/10919)~/$ lsmod | grep nvi

lspci -k shows the kernel modules:

0c:00.0 VGA compatible controller: NVIDIA Corporation GP104 [GeForce GTX 1070] (rev a1)
        Subsystem: Gigabyte Technology Co., Ltd GP104 [GeForce GTX 1070]
        Kernel modules: nvidiafb, nouveau

This output implies no nvidia driver is installed on my system5. …though it is.

$ nvidia-settings --version
nvidia-settings:  version 465.19.01

software-properties-gtk tells me I’m using the proprietary nvidia-driver-460, not 465

In any case, can’t blacklist nouveau as still there are no ubuntu kernel modules.


(19:04:04/10946)~/$ dkms status
nvidia, 460.73.01: added

Also, inxi -Fxxxrz (found somewhere on the internet):

Graphics:  Card-1: Intel UHD Graphics 620 bus-ID: 00:02.0 chip-ID: 8086:5917
           Card-2: NVIDIA GP104 [GeForce GTX 1070] bus-ID: 0c:00.0 chip-ID: 10de:1b81
           Display Server: x11 (X.Org 1.19.6 ) drivers: modesetting,nvidia (unloaded: fbdev,vesa,nouveau)

It it sees them as there and loaded? Does dkms somehow bypass lsmod etc?

sudo dkms autoinstall should autoinstall all added drivers, …let’s hope for the best I guess.

(19:11:47/10958)~/$ sudo dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...
applying patch disable_fstack-clash-protection_fcf-protection.patch...patching file Kbuild
Hunk #1 succeeded at 85 (offset 14 lines).

Building module:
cleaning build area...
unset ARCH; [ ! -h /usr/bin/cc ] && export CC=/usr/bin/gcc; env NV_VERBOSE=1 'make' -j8 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=5.4.0-72-generic IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=/lib/modules/5.4.0-72-generic/build LD=/usr/bin/ld.bfd modules......(bad exit status: 2)
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/nvidia-dkms-460.0.crash'
Error! Bad return status for module build on kernel: 5.4.0-72-generic (x86_64)
Consult /var/lib/dkms/nvidia/460.73.01/build/make.log for more information.

The file is long, keys seems:

 scripts/ recipe for target '/var/lib/dkms/nvidia/460.73.01/build/nvidia/nv.o' failed
 make[2]: *** [/var/lib/dkms/nvidia/460.73.01/build/nvidia/nv.o] Error 1
 Makefile:1754: recipe for target '/var/lib/dkms/nvidia/460.73.01/build' failed
 make[1]: *** [/var/lib/dkms/nvidia/460.73.01/build] Error 2
 make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-72-generic'
 Makefile:80: recipe for target 'modules' failed
 make: *** [modules] Error 2
DKMSKernelVersion: 5.4.0-72-generic
Date: Fri Apr 30 18:30:45 2021
DuplicateSignature: dkms:nvidia-dkms-460:460.73.01-0ubuntu1:/var/lib/dkms/nvidia/460.73.01/build/conftest/functions.h:11:2: error: #error acpi_walk_namespace() conftest failed!
Package: nvidia-dkms-460 460.73.01-0ubuntu1
PackageVersion: 460.73.01-0ubuntu1
SourcePackage: nvidia-graphics-drivers-460
Title: nvidia-dkms-460 460.73.01-0ubuntu1: nvidia kernel module failed to build

Smells like a driver/kernel support isse?

First result when googling dkms nvidia 460 is this: Can’t get nvidia 460 module to build on Ubuntu 20.04 to support two A100s - GPU Unix Graphics / Linux - NVIDIA Developer Forums

Please check if the build symlink to the headers for dkms exists:

ls /lib/modules/$(uname -r)/build

Otherwise, create it

ln -s /usr/src/linux-headers-$(uname -r)  /lib/modules/$(uname -r)/build

Didn’t have it, created it, trying again, same error, deleted the previous log, full output is:

(19:19:54/10967)~/$ sudo dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...
applying patch disable_fstack-clash-protection_fcf-protection.patch...patching file Kbuild
Hunk #1 succeeded at 85 (offset 14 lines).

Building module:
cleaning build area...
unset ARCH; [ ! -h /usr/bin/cc ] && export CC=/usr/bin/gcc; env NV_VERBOSE=1 'make' -j8 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=5.4.0-72-generic IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=/lib/modules/5.4.0-72-generic/build LD=/usr/bin/ld.bfd modules.......(bad exit status: 2)
Error! Bad return status for module build on kernel: 5.4.0-72-generic (x86_64)
Consult /var/lib/dkms/nvidia/460.73.01/build/make.log for more information.

The file is full of what looks like syntax errors..?

This charming chinese website seems to imply gcc version is to blame: NVIDIA驱动出错:NVIDIA-SMI has failed because it couldn‘t communicate with the NVIDIA driver. Make sure t_sazass的博客-CSDN博客

(19:22:39/10974)~/$ cat /proc/version
Linux version 5.4.0-72-generic (buildd@lgw01-amd64-021) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #80~18.04.1-Ubuntu SMP Mon Apr 12 23:26:25 UTC 2021
sudo apt install gcc-8
sudo update-alternatives --config gcc
sudo update-alternatives --remove-all gcc
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-8 10

Let’s retry dkms autoinstall:

(19:26:03/10981)~/$ sudo dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...
applying patch disable_fstack-clash-protection_fcf-protection.patch...patching file Kbuild
Hunk #1 succeeded at 85 (offset 14 lines).

Building module:
cleaning build area...
unset ARCH; [ ! -h /usr/bin/cc ] && export CC=/usr/bin/gcc; env NV_VERBOSE=1 'make' -j8 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=5.4.0-72-generic IGNORE_XEN_PRESENCE=1 IGNORE_CC_MISMATCH=1 SYSSRC=/lib/modules/5.4.0-72-generic/build LD=/usr/bin/ld.bfd modules...............
Signing module:
 - /var/lib/dkms/nvidia/460.73.01/5.4.0-72-generic/x86_64/module/nvidia-modeset.ko
 - /var/lib/dkms/nvidia/460.73.01/5.4.0-72-generic/x86_64/module/nvidia.ko
 - /var/lib/dkms/nvidia/460.73.01/5.4.0-72-generic/x86_64/module/nvidia-uvm.ko
 - /var/lib/dkms/nvidia/460.73.01/5.4.0-72-generic/x86_64/module/nvidia-drm.ko
Secure Boot not enabled on this system.
cleaning build area...

DKMS: build completed.

Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-72-generic/updates/dkms/

Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-72-generic/updates/dkms/

Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-72-generic/updates/dkms/

Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.4.0-72-generic/updates/dkms/


DKMS: install completed.


Without even restarting, after the first command my screen flashed and changed resolution a bit, BUT THEN IT WORKED

(19:34:17/10983)~/$ nvidia-smi
No devices were found
(19:34:20/10984)~/$ nvidia-smi
Fri Apr 30 19:34:22 2021
| NVIDIA-SMI 460.73.01    Driver Version: 460.73.01    CUDA Version: 11.2     |
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|   0  GeForce GTX 1070    On   | 00000000:0C:00.0 Off |                  N/A |
|  0%   54C    P0    37W / 151W |      7MiB /  8119MiB |      0%      Default |
|                               |                      |                  N/A |

| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|  No running processes found                                                 |

All these attempts failed because the nvidia module in dkms couldn’t install because syntax errors because old gcc compiler version.

What could I have done differently? Why at no point did I see errors about the kernel module failing to build, where should I have looked for them? And why syntax errors instead of something checking the used gcc version and loudly failing when there was a mismatch? Why is that chinese website the only place I found this fix?

(19:42:57/10995)~/$ lsmod | grep nvidia
nvidia_uvm           1015808  0
nvidia_drm             57344  1
nvidia_modeset       1228800  1 nvidia_drm
nvidia              34123776  17 nvidia_uvm,nvidia_modeset
drm_kms_helper        188416  2 nvidia_drm,i915
drm                   491520  15 drm_kms_helper,nvidia_drm,i915

Now let’s hope this survives a restart. And that it works when the eGPU is disconnected.

NVIDIA data-science-stack

Following the readme, ran both options in separate terminals:

./data-science-stack list
./data-science-stack build-container
./data-science-stack run-container


./data-science-stack list
./data-science-stack build-conda-env
./data-science-stack run-jupyter

The latter seems to be installing CUDA and friends on my computer - didn’t expect it, but I need them either way I think, I guess I’ll let the script handle everything since it started. It installed conda to ~/conda/, but again, not sure what I was expecting

Both running for 20+ minutes now

EDIT: ~/conda/ took 20gb filling up my drive, blocking everything, deleted it

The docker with jupyterlab - tensorflow can’t access the GPU, but pytorch can.

Carrying on with setting the eGPU up

The NVIDIA eGPU tutorial3 continues with offloading Xorg to the GPU - do I want this? Can I use the GPU just for training, and leave Xorg running on the internal one? I probably don’t

Restarting and testing

As I remember from the last time, X doesn’t start when the GPU is connected at boot but everything’s fine when it gets connected after starting X. When it’s connected, it seems the driver gets loaded and nvidia-smi etc works. That the system works without the eGPU attached is nice! Plug-and-play is nice too.

Installed pytorch in a virtualenv, for cuda 11.1, test snippet says cuda works!

import torch
x = torch.rand(5, 3)



>>> import tensorflow as tf
2021-04-30 21:36:12.984883: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
>>> tf.debugging.set_log_device_placement(True)
>>> a = tf.constant([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]])
2021-04-30 21:36:23.055614: I tensorflow/compiler/jit/] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-04-30 21:36:23.058062: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.115366: I tensorflow/stream_executor/cuda/] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-04-30 21:36:23.116510: I tensorflow/core/common_runtime/gpu/] Found device 0 with properties:
pciBusID: 0000:0c:00.0 name: GeForce GTX 1070 computeCapability: 6.1
coreClock: 1.721GHz coreCount: 15 deviceMemorySize: 7.93GiB deviceMemoryBandwidth: 238.66GiB/s
2021-04-30 21:36:23.116553: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.119974: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.120034: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.121503: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.121842: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.125037: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.125803: I tensorflow/stream_executor/platform/default/] Successfully opened dynamic library
2021-04-30 21:36:23.125980: W tensorflow/stream_executor/platform/default/] Could not load dynamic library ''; dlerror: cannot open shared object file: No such file or directory
2021-04-30 21:36:23.125996: W tensorflow/core/common_runtime/gpu/] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at for how to download and setup the required libraries for your platform.

Which libcudnn?

Tensorflow’s tutorial (GPU support  |  TensorFlow) does this:

Install development and runtime libraries (~4GB)
sudo apt-get install --no-install-recommends \
    cuda-11-0 \
    libcudnn8=  \

What is the version for CUDA 11.2? cuDNN Archive | NVIDIA Developer has download links. The one for 11.2 is called “cudnn-11.2-linux-x64-v8.1.1.33.tgz”. I plug those versions in, they exist and install fine:

sudo apt-get install   libcudnn8=
sudo apt-get install   libcudnn8-dev=

And tensorflow now works!

2021-04-30 21:42:46.176942: I tensorflow/core/common_runtime/gpu/] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7440 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1070, pci bus id: 0000:0c:00.0, compute capability: 6.1)

I can’t believe it but wow. It’s finished, it works, X didn’t die, plug-and-play works, no manual driver loading.

All in all, including all the failed attempts, took 5:30h of pure time, according to my time tracking.

The only wrinkle is that X doesn’t start when turning the computer on with the eGPU attached, but I can 100% live with that!

GPU benchmarking linux

How to Benchmark your GPU on Linux has a fun quote:

This tool is very old, very basic and only tests a small portion of today’s OpenGL capabilities. Back in the old days, it was used to determine if the proprietary driver was installed and running properly as open-source drivers were performing awfully enough to be perfectly noticeable during this test. Nowadays, you won’t notice any difference between the two

qutebrowser open a private window

Added this to

config.bind('<Alt-P>', 'set-cmd-text -s :open -p ')

Managing dotfiles with machine-specific configuration

Qutebrowser import other config files

Seen in someone’s on gitlab6:

for f in glob.glob(str(config.configdir / 'conf.d/*.py')):
    config.source(str(os.path.relpath(f, start=config.configdir)))

Random i3 configs

Nice examples: i3_config/settings.d at master · kiddico/i3_config · GitHub

i3 doesn’t have any kind of include directive in the config files, sadly. i3 - Source/import file from i3wm config - Stack Overflow is one option:

bindsym $mod+Shift+c exec "cat ~/.config/i3/colors ~/.config/i3/base > ~/.config/i3/config && i3-msg reload"

A keybinding to overwrite the config file and restart i3 with a command.

To read - life hacking

This looks very interesting, I shouldn’t forget to go through this: Life Hacking His blog with personal examples: Alex Vermeer — Life-Hacking. Climbing. Striving for awesome. Coffee. — Page 2

A non-pdf description of Life Areas with questions and metrics for each.

(He’s the same guy who created the awesome How to Get Motivated: A Guide for Defeating Procrastination poster!)

And let’s remember the classic: Evidence-based advice on how to be successful in any job - 80,000 Hours

Detach process completely from terminal

Two options I like:7

  • nohup cmd &
  • cmd & disown

I feel one of these will become part of many aliases of mine.

And short bash function from the same place:

function dos() {
    # run_disowned and silenced

    run_disowned "$@" 1>/dev/null 2>/dev/null

Day 849


To read: PEP 8 – Style Guide for Python Code |

English / random

  • “If you feel a misalignment with …”
  • Ticketize (verb)

Jira ticket search and filtering

I should learn about the search syntax for jira tickets:

assignee = currentuser() and statusCategory != Done ORDER BY updated DESC

Day 848

Installing CUDA and pytorch and tensorflow

Following this: CUDA 10.1 installation on Ubuntu 18.04 LTS | Medium nope, errors

In the same github discussion about installing CUDA on ubuntu that I’ve been to twice this bit is mentioned: 1

The very very important thing is that never install “nvidia-driver-***” driver by yourself.

Required nvidia drivers are installed while doing sudo apt install -y cuda=10.0.130-1

Zsh wildcards and apt-get remove

sudo apt remove --autoremove nvidia-* doesn’t work as-is in zsh! * gets interpreted as files in current directory. Explains my CUDA issues, everything seemed to work till I ran the above in a directory containing files with matching names that got helpfully shown.

sudo apt remove --autoremove nvidia-\* is the answer.

(or 'nvidia-*')

Not the first time this bites me, at least the third, and all of them in the context of doing CUDA stuff.


“Es funktioniert fabelhaft” - heard at work

Purging packages

apt --fix-broken install didn’t help as advertised, but removing all the broken packages together with sudo dpkg -P cuda-libraries-10-0 libnvidia-common-390 helped! After this removing/cleaning up everything else worked. A lot of this mentioned changes to initramfs, I really hope I’ll be able to boot up next time :(

Also - if 90% of the tutorials about how to install $thing start with “Remove any traces of installs of $thing you have” it’s a nice sign that something’s shady.

Docker logs

docker logs 09348209840239

i3 skype floating window fix

Skype fix : i3wm:

Option 1: hide the floating window:

for_window [title="^Skype$" floating] move scratchpad

Option 2:

Clever idea. Although, are you talking about the little window that can be disabled in Skype’s “Settings > Calling > Show call window when Skype is in the background”?

Slack show all messages in all channels

In search, before:Tomorrow is a nice catch-all filter

Pytorch installs its own CUDA!

Your system installations of CUDA and cudnn won’t be used, if you install PyTorch binaries with these libs. E.g. conda install pytorch torchvision cudatoolkit=10.1 -c pytorch will install CUDA 10.1 and cudnn in your current conda environment. 2

Tensorflow CUDA Docker doesn’t need CUDA on host machine, only the nvidia drivers

Nvidia drivers are needed on host machine, but not CUDA! 3

Random / UX / Design?

On TF’s official CUDA install page4, the bash listings (that are usually copypasted) contain the standard $ at the beginning, it’s visible, but not copypastable!

Installing CUDA 11.0 using official Tensorflow tutorial

So, hopefully the last time today, as the previous couple of times I end up in the official TF tutorial4 about installing CUDA. Armed with the knowledge that:

  • pytorch installs its own CUDA and doesn’t care, as long as GPU drivers are there
  • Docker installs its own CUDA and doesn’t care, as long as GPU drivers are on the host machine
  • Installing nvidia drivers should not be manual, it has to be done by the cuda packages


# Add NVIDIA package repositories
sudo mv /etc/apt/preferences.d/cuda-repository-pin-600
sudo apt-key adv --fetch-keys
sudo add-apt-repository "deb /"
sudo apt-get update


sudo apt install ./nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb
sudo apt-get update

sudo apt install ./libnvinfer7_7.1.3-1+cuda11.0_amd64.deb
sudo apt-get update

# Install development and runtime libraries (~4GB)
sudo apt-get install --no-install-recommends \
    cuda-11-0 \
    libcudnn8=  \

# Reboot. Check that GPUs are visible using the command: nvidia-smi

# Install TensorRT. Requires that libcudnn8 is installed above.
sudo apt-get install -y --no-install-recommends libnvinfer7=7.1.3-1+cuda11.0 \
    libnvinfer-dev=7.1.3-1+cuda11.0 \

Done, no conflicts, no anything, worked better than most Medium tutorials I’ve read today.

# Reboot.

Let’s hope for the best.

UPD: no black screen, booted fine, but nvidia-smi sees no driver.

sudo apt list --installed shows all cuda stuff and nvidia driver to be installed:

nvidia-driver-465/unknown,unknown,now 465.19.01-0ubuntu1 amd64 [installed,automatic]

More worryingly, I see mentions of cuda-10-1 and cuda-11-1 together

list processes ubuntu

I should use ps axf instead of ps aux, the former gives a nice tree representation

Nvidia CUDA official installer documentation

Yet another place that makes it look easy: CUDA Toolkit 11.0 Download | NVIDIA Developer

Day 847

Docker stuff

  • Making it run as non-root: Post-installation steps for Linux | Docker Documentation
    • newgrp docker has to be run from each cli you’ll be using docker from?.. Until you restart
  • Best tutorial ever can be started with: docker run -d -p 80:80 docker/getting-started
    • It will start as docker image
    • Very readable and step-by-step
  • Docker compose
  • Random docker stop accepts the full name (distracted_perlman), but part of its container_id works!
  • Unintuitively, the COPY instruction from a Dockerfile copies the contents of the directory, but not the directory itself! 1

Clean up journalctl

Logs take space (4gb on my box!). To see how much specifically journalctl does:2

journalctl --disk-usage
sudo journalctl --vacuum-time=3d

Jupyter notebooks has terminals!

New -> Terminal. (Which you can use to access your docker running jupyter-notebook)

Docker build contexts and relative paths

$ docker build -t dt2test -f ./docker/Dockerfile . - passes the Dockerfile as explicit parameter, inside it paths are relative to the folder you run docker build in.

For docker compose:

version: '3.3'    
          context: ./
          dockerfile: ./docker/yourservice/Dockerfile

A lot of other nice options at Docker: adding a file from a parent directory - Stack Overflow

Day 843

Python dataclasses


“Token classification” includes but is not limited to NER: Hugging Face – The AI community building the future.. Really nice new correct phrase I’ll be using!

Installing (after tensorflow and/or pytorch):

pip install transformers

Caches by default in user folder but can be overridden:

export HF_HOME="/data/sh/experiments/bert/cache" 

The “hosted inference API” on the website is really cool! dslim/bert-base-NER · Hugging Face

Example of converting conll dataset to what BERT expects: Fine Tuning BERT for NER on CoNLL 2003 dataset with TF 2.0 | by Bhuvana Kundumani | Analytics Vidhya | Medium

The BERT model documentation shows the tokenizers etc etc etc. - BERT — transformers 4.5.0.dev0 documentation

python datasets package

Here datasets is imported: transformers/requirements.txt at master · huggingface/transformers

TODO - what is this and where can I learn more? Is this HF specific? What else is there?

HuggingFace datasets

It has a really nice interface for searching datasets! Filter by task, language, etc.

German NER datasets: Hugging Face – The AI community building the future.

Some German NER models, sometimes based on bert: Hugging Face – The AI community building the future.

Huggingface converting between tf and pytorch

Converting Tensorflow Checkpoints — transformers 4.5.0.dev0 documentation

Is this real?

export BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12

transformers-cli convert --model_type bert \
  --tf_checkpoint $BERT_BASE_DIR/bert_model.ckpt \
  --config $BERT_BASE_DIR/bert_config.json \
  --pytorch_dump_output $BERT_BASE_DIR/pytorch_model.bin

Random / recipes / cooking

Tatar von geräuchertem Forellenfilet mit Avocado - Annemarie Wildeisens KOCHEN

Die Forellenfilets in kleine Würfelchen schneiden. Die Schalotte schälen und sehr fein hacken. Die Cherrytomaten je in 6 oder 8 Stücke schneiden. Alle diese Zutaten in eine kleine Schüssel geben und sorgfältig mit der Mayonnaise mischen.

Forelle + tomatos + mayonnaise is literally the only recipe I’ve liked with mayonnaise in it

Day 842

Jira old issue view + qutebrowser config setting

To redirect an issue to the old view, add ?oldIssueView=true.

Added this to

config.bind('<Ctrl-J>', ':open {url}?oldIssueView=true')

Ubuntu screen apt-get

(18:03:38/10185) sudo apt install screen
# ...
Suggested packages:
  byobu | screenie | iselect
The following NEW packages will be installed:

… did I just get an advert for a competitor when installing screen? :) Since when does ubuntu do this and where can I read more about it?

Day 841

Deutsch / German

“Meetingtourismus oder Papiergenerieren?” (heard at work)

Qutebrowser userscripts

It seems to run userscripts not in the virtualenv qutebrowser uses, but the standard system one? Installing packages in virtualenv didn’t work, but installing them globally did.


Moving/renaming a file/directory is easy: dvc move from to1. Automatically updates the from.dvc files. Then .gitignore and the .dvc file have to be added and committed through git as usual.

This is interesting: Data Organization — documentation

In general: Best Practices for Scientific Data Management — documentation

This guide describes Axiom Data Science’s best practices for scientific data management. The intent of these practices is to improve the accessibility and usability of your data. These practices may be followed at any time during the preparation of your dataset, but are most useful when considered at the onset of project planning and implemented during data collection.

Also related: Organising your data | Research Data Management

Tree output only directories

tree -d does it.

Git paths from root of repo

Root of repo: git rev-parse --show-prefix 2

--git-dir returns the location of the .git folder, and --show-toplevel returns the absolute location of the git root.

Day 840

Patterns / phrases / Random

  • “It’s not a solution, but it’s an approach” - heard at work, VF

Day 839

vim delete all lines not matching pattern

I’ll memorize the g/... syntax someday.


I can just look for the pattern as usual with /pattern and tweak it live, then do


and it will atke the last used pattern.

Day 838

Pizza sauce recipes

I should try doing something more interesting with the passata di pomodoro!


In general all seem to require both tomato puree and chopped tomatoes; and olive oil + garlic + oregano/basil + (brown) sugar seems to cover 90% of cases.

Day 836


die Kaffeesatzleserei - reading in coffee beans (heard at work)

screen attaching screens without full name

I shouldn’t forget that screen -R screenname can be replaced by screen -R s if it’s the only screen with such a name. Not sure if better or worse than tab completion, likely worse because it’s surprising, but quite nice to use.

Logoff i3 with a CLI

i3-msg exit1 does the magic.

Blocking ips with ipset

ipset -N myset nethash  # create myset
ipset add myset 
iptables -I INPUT -m set --match-set myset src -j DROP # create temporary iptables thing

# making it persistent

ipset save > /etc/ipset.conf

# then enable ipset services

# Listing stuff
ipset -L

# Deleting set
ipset destroy myset

iptables basics

If you can’t destroy an ipset set because it’s being used by kernel:

iptables -L --line-numbers returns this:

Chain INPUT (policy DROP)
num  target     prot opt source               destination
1    DROP       all  --  anywhere             anywhere             match-set myset src

Then to delete number 1:

iptables -D INPUT 1

Generally blocking countries

GitHub - mkorthof/ipset-country: Block countries using iptables + ipset + can do both a whitelist and a blacklist.

Day 835

Data Scientist roadmap/curriculum

Article with a very interesting graph: Becoming a Data Scientist - Curriculum via Metromap – Pragmatic Perspectives

Road to data science

German / Deutsch

  • “Die Prioritäten sind ein bißchen volatil geworden”
  • “Sammle von XY Team ein bißchen Stimmung”

Day 832


der Tonus - heard at work in context of

JQ producing nice comma-separated json

Option to return objects as a list of objects (separated by a comma) · Issue #124 · stedolan/jq: TL;DR use jq "[foo]" instead of jq "foo".

Day 831

Yunohost full app information / data / install paths

yunohost app info -f appname returns the A LOT of info about the appname, including installation paths.

Qutebrowser userscripts folder location / Writing informative error messages

… can be located in ~/.config/qutebrowser/userscripts, not just in ~/.local ..! When tried to run one it didn’t find it helpfully outputted all the paths it looks for them - which is great and I’ll steal this. If a file is not found you know the person will probably need this, especially if they are many.

GNU Stow for dotfiles management

One of the cooler solutions I’ve seen: Managing dotfiles with GNU stow - Alex Pearce (There seems to be a canonical page1 I found first, but I like the other one more)

TL;DR create a directory for the dotfiles, with each folder containing dotfiles mirroring the usual dotfiles’ locations in the system; Then from inside the main dotfiles directory do stow vim bash whatever and it’ll magically put it in the right place in the home directory.

This works because

Stow assumes that the contents of the

you specify should live one directory above where the stow command is run, so having our .dotfiles directory at ~/.dotfiles means using stow to manage our dotfiles just works. [^stowbett]

This is awesome because:

  • No manual symlinking
  • Dotfiles directory can be easily backed up with git or whatever

The same article2’s sample github repo: dotfiles/neovim at master · alexpearce/dotfiles

Cool dotfile ideas

The stow linked github repo’s dotfiles are actually fascinating: alexpearce/dotfiles: My dotfiles.

dotfiles/.gitconfig at master · alexpearce/dotfiles:

# Clone git repos with URLs like "gh:alexpearce/dotfiles"
[url ""]
  insteadOf = "gh:"
[url ""]
  pushInsteadOf = "gh:"
# Clone CERN GitLab repos with URLs like "gl:lhcb/Hlt"
[url "ssh://"]
  insteadOf = "gl:"

Git config aliases

Applying the above to my own configs in ~/.gitconfig.

Assuming the ssh port is 1234 ~/.gitconfig is like

[url "ssh://git@myserver:1234/"]
  insteadOf = "gh:"

and then in the per-repo settings something similar to

[remote "bitbucket"]
	url = gh:myusername/myproject.git

Cloning it is now easy:

git clone gh:myusername/myproject


Jekyll syntax highlighting supported languages

List of supported languages and lexers · rouge-ruby/rouge Wiki Quite a lot! Will try the generic conf for the .gitconfig above.

Day 830


I’m very impressed by it! Makes everything really easy, I remember the last time I had to install stuff manually. After 48h 9/10, some things surprised me (removing root ssh access…) but they were always mentioned in the relevant docu I hadn’t read.

Official docu is quite okay, but rarely appeared when I was googling my problems. My instinct is to Google the problem instantly - sometimes they should actually be to find and check any existing official documentation/README first, then google. (An even better instinct would be to skim any official documentation before starting, as religiously as I do it for unknown real-life 3D things.)

Adding subdomains for Yunohost

This took me too long to find, has info about correct DNS records: DNS and subdomains for the applications | Yunohost Documentation

By trial and error the complete process is:

  1. Add DNS record for subdomain like last examples here: ``` @ A XYZ.XYZ.XYZ.XYZ @ AAAA 1234:1234:1234:FFAA:FFAA:FFAA:FFAA:AAFF
    • CNAME agenda CNAME blog CNAME rss CNAME ```
  2. Add new domain to yunohost, input the domain with subdomain ( as it if were new
  3. Do a diagnostic, which does DNS checks too, which are needed for Letsencrypt
  4. Install letsencrypt certificate from the usual Yunohost panel

I kept messing up NAME and DATA of the CNAME records because I was following more the other ones Yunohost created, a row of

Data: @

For I needed this (kinda-sorta-reversed from the above; as usual, dots are significant):

Name: my.domain.
Data: subdomainname

Random / colored fonts generator / CLI

cfonts is like figlet, but with many more settings (colors and alignment blew my mind!)! Link has a lot of colorful examples. I might get a nice colorful motd and/or banner soon. :)

Setting a new hostname linux

There’s a command for that: hostnamectl set-hostname new-hostname

I like the idea of having ~/.local/bin in my $PATH, and putting there symbolic links (ln -s TARGET LINK) to my usual folder where I have programs/executables. I’d even have a separate thing in $PATH for shell scripts and binaries, which will get rid of so many stupid CLI aliases I have whose function is to point to a single executable with a long path. TODO - look at my aliases and commands I run often and see how many of them can I symlink

Day 829

VPS plans

  • Taskwarrior sync
  • git for ~/.timewarrior/ and similar folders
  • git for dotfiles
  • Some basic automated backups of small important things
  • Possibly some Telegram bots will live there
  • CalDAV & Contacts sync - both for sync and for backups
  • Possibly self-hosted password management?

Timewarrior on-modify hook for taskwarrior

Had always problems with umlauts etc, looked at the source, changed #!/usr/bin/env python to #!/usr/bin/env python3 - now it works! Wanted to do a pull request, but it’s fixed on github master1, the apt repo has an older version as it often does.

git clone to different directory

.. As expected. git clone git@what:ever outputdirectory. git clone git@what:ever . works.

Setting up

New domain, yay! I’ll slowly move stuff there, starting with this diensttagebuch.

Setting up multiple remotes in github + .git/config

I wanted to set up two remotes, so that the dtb script after building the html & rsync-ing would push it to both the github dtb repo and my own. Followed this basically (except that I had deleted origin by error in the process, so recreated it back again and added both remotes to it so I’ll still be able to do git push origin master): How to push to multiple git remotes at once. Useful if you keep mirrors of your repo..

Mostly copying from there, changing/sanitizing some of my configs:

# Assume the git repost are set up like this
git remote add github #this is the one "origin" pointed to to
git remote add bb

# Add to origin two remote urls for push
git remote set-url --add --push origin
git remote set-url --add --push origin

# Look at the result
git remote show origin

which outputs this:

> git remote show origin
* remote origin
  Fetch URL:
  Push  URL:
  Push  URL:
  HEAD branch: master

Mentioned in the comments, it works, but has to be done twice of as it seems to rewrite the original remote: git remote set-url --add --push origin <...>

But maybe the most interesting thing there is .git/config! I didn’t know it existed, it shows most of the same things but much easier to read/edit! It currently shows something like this:

> cat  .git/config
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[branch "master"]
	email =
	name = SH
[remote "bb"]
	url =
	fetch = +refs/heads/*:refs/remotes/bb/*
	pushurl =
[remote "github"]
	url =
	fetch = +refs/heads/*:refs/remotes/github/*
	pushurl =
[remote "origin"]
	url =
	fetch = +refs/heads/*:refs/remotes/origin/*
	pushurl =
	pushurl =

Creating redirects to new website

Adding the RedirectPermanent lines to .htaccess in the root of, that now contains the following:

ErrorDocument 404 /404.html
ErrorDocument 403 /404.html
ErrorDocument 500 /500.html

RewriteRule ^wiki/(.*)$ /f/$1 [R=301,NC,L]
RewriteRule ^fiamma/(.*)$ /f/$1 [R=301,NC,L]

RedirectPermanent /d/dtb
RedirectPermanent /blog

Experimenting with rewriting everything except /f/, seems to work except for the main page

RewriteEngine on

#RewriteRule (f) - [L]
RewriteCond %{REQUEST_URI} !^/f
RewriteRule (.*)$1 [R=301,L]

It gets redirected to - maybe it chokes on the many weird characters or the repeat of

Setting up HTTPS/TLS for

As per nfs docs 2, it’s very easily done just by running YourPrompt>, and nfs takes care of all autorenewals, automatically sets up redirects etc. Awesome!


utimer can do a countdown, count-..up?, and can work as a stopwatch. It outputs time remaining too.


A pizza dough recipe3 reminded me that

DTB/markdown/footnotes/macro improvement idea

I have my vim macro for footnotes where it creates the [^..] things and then I paste the URI manually, but what I’d actually like is something that automatically creates a footnote at current cursor position, and as content uses the URI currently in the clipboard register! TODO (And also try to make it readable/interpretable this time)


To create a subdomain, you have to add it as “new” new domain and it takes care of everything, no magic with DNS records needed

Day 825

taskwarrior non-work user account

Changed the zsh alias for it:

s () {task s project.not:w sprint.not:s "$*"}

Now on my non-work account, it shows non-work tasks from any sprint except “s” (which is a proxy of due:someday).

German foreign words

Foreign Words (Fremdwörter) - really nice! Has specific suffixes and what genders they create in German. In general - I remember that excellent website.

Also: “das Thema, die Themen”) - which plural rule is that? TODO


Given that I need to push/pull it a lot now, I should exclude the generated .html files in .gitignore


W opens the last closed window! … on the topic of ‘learn well the tools you use daily’


Installed ding! Still remains the best dictionary program ever. ding buch works!

TODO - add keybinding to search for currently selected word. Or a basic prompt to quickly look for words, a la dtb - and that ideally adds the needed words to a list, and maybe even generates anki flashcards from them!

ding -m to start it minimally, likely make it floating for i3 by class, is a really nice start. Added this to config:

## Ding float
bindsym $ms+Shift+d exec ding -m
for_window [class="Ding"] floating enable

(got class from xprop)

Redshift settings for late-night work

If default automatic settings are too strong, these work well: redshift -xO 2500 -b 0.7

Day 823

Noisetorch / polkit / policykit / pkexec saga

Couldn’t load noisetorch, error 127 when attempting to get the needed privileges. The help of Noisetorch said this means pksudo doesn’t work, and to fix this. After some googling, found a solution:

apt install policykit-1-gnome

Then add /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 & to your autostart configuration. 1

Day 821

Interactive mode matplotlib

According to the docu it should be this, not working for me:


Somehow it magically worked before without any changes from my side actually. Anyway, this1 worked:

import matplotlib
import matplotlib.pyplot as plt

Day 818

i3 startup - final

I can’t start everything from within i3 config. keynav doesn’t work (though it’s running), and compton creates a black strip in the bottom monitor when started as exec compton via i3. Though executing a startup script from within i3, a script starting everything else I need, somehow works. I remember dealing with this in the past, and this created the current chaotic setup.

Startup script (./s/ :

setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin, compose:paus' v5,ruua
xmodmap ~/s/mod4
xcape -e 'Control_L=Escape' -t 100 

autorandr -l home

feh --bg-center ~/s/bg.jpg ~/s/bg.jpg



i3 config startup script:

exec ~/s/
exec --no-startup-id redshift
exec --no-startup-id nm-applet

Removing dysfunctional setups

vim - remove save as root

I had this, but it started too often by error.

:W sudo saves the file 
" command W w !sudo tee % > /dev/null

New zsh prompt

Added this in a modified sh-trapd00r theme:

dir_status="%{$c1%}%* %B%7c/ %?"
PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${dir_status} ${ret_status}%{$reset_color%}
%{$fg_bold[green]%}> %{$reset_color%}'

Day 817

loginctl as a way to manage sessions of logged in users

Instead of killing all processes belonging to someone, loginctl will return all sessions, and loginctl kill-session $number will log the user off!

New non-work user account!

Set my old Lain background with feh. I should look at some of my old i3 settings etc, to make it look different from the work one.

  • zsh theme: trapd00r
  • vim theme: pablo

General plans for vacation

  • Don’t touch any ‘should’s - java, python, …; mostly focus on ‘housekeeping’ things if I want to do stuff with the computer
  • Learn to use kitty well
    • Highlighting/copying URIs etc especially
    • See if I can use it to replace some of my hacks
  • Learn to use tmux or screen well
    • Screen is available almost everywhere, but tmux is ‘better’
  • Learn to use vim much better
    • Make an effort to learn it systematically and well from the beginning, I have a lot of antipatterns
    • w/E etc
    • vim recovery of swap files
  • Sort out my i3/user config and all configs in general
    • Something easy to enable/disable keyboards (xinput float ..)
    • Something to turn on/off audio/webcamera
    • Move container splitting keybinding further away from window closing keybinding
  • Sort out all dotfiles
    • A place where they are by default and can be imported/overwritten
    • In general any kind of dotfiles management/backup
  • Sort out my startup scripts
    • In general something that doesn’t make me afraid to disconnect the laptop from the screen
      • Automatically use connected screens, without arandr-ing every time
      • Same for keyboards
      • Same for keyboard layouts
      • Run redshift and stuff only once
      • Even just an i3 keybinding that sets up what’s needed

“Ricing” - English / Unix / …

  • Ricing is “making improvements to a system that don’t actually do anyone any good, and can sometimes have negative ramifications” 1
  • “Rice” is “a word that is commonly used to refer to making visual improvements and customizations on one’s desktop. It was inherited from the practice of customizing cheap Asian import cars to make them appear to be faster than they actually were” 2

(was curious about the name of a PPA)

i3 stuff

Test config file:

  - name: eDP-1
    workspaces: [1, 0]
    randr_extra_options: "--primary --mode 2560x1440"
  - name: HDMI-2
    workspaces: [2, 3, 4]
    randr_extra_options: "--above eDP-1"

autorandr for flexible multimonitor setup

This is even better than the above: phillipberndt/autorandr: Auto-detect the connected display hardware and load the appropriate X11 setup using xrandr It saves configs readably and automatically to ~/.config/autorandr/config

General small things

  • autorandr set up
  • i3lock
  • better autostart
    • start the diensttagebuch, work notes in the correct workspaces
    • start slack, Telegram and co in the correct workspaces
    • Put workspaces on the correct screens

i3-gaps fun

Very simple config:

gaps inner 10
gaps outer 10

Installed compton to get transparent terminals. Added this to kitty config:

background_opacity 0.8

Git use use specific public key file

When using public key and ssh for git, when you can’t use ssh-add ..., this works: GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example" git clone example 3

Day 813

Pycharm / matplotlib / pyplot debugging

I can happily use plt.plot()/plt.imshow() inside the <Alt-F8> and debugger console windows, it’ll be shown!

Recursively change owner in files owned by other user in current directory

Replace -user root with source user, $USER expands to user currently running command:

sudo find ~ -type d -user root -exec sudo chown -R $USER: {} +

Day 812

sshfs / ‘Transport endpoint not connected’

In line with Day 784 about unmounting broken endpoints, yesterday I got a lot of errors (thunar didn’t start, I blamed memory, but df -h also didn’t start…), at the end the issue was with a sshfs directory:

fuse: bad mount point ./mountpoint’: Transport endpoint is not connected`

Using day 784 didn’t help, still got the above error. This helped: fusermount -uz myserver

Also, TODO: Why doesn’t linking stuff like this work?

[Day 784]({% post_url 2021-02-23-day784.markdown %})

numpy true booleans

a is True is false for a numpy array of one element a, even if it’s value is True. a == True works correctly. Why does this happen?

pycharm debugging in console

You can use the console not just to look for output, but to interact with the variables etc! Why didn’t I think of this before: Using Debug Console | PyCharm

Day 811

OpenCV documentation

I like giving code examples in C++, Java and Python for the same help topic! OpenCV: Creating Bounding boxes and circles for contours

Disabling touchpad while typing (xinput)

(22:31:53/11773)~/$ xinput list-props 15
Device 'SynPS/2 Synaptics TouchPad':
	Device Enabled (170):	1
	Coordinate Transformation Matrix (172):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (304):	1
	Device Accel Constant Deceleration (305):	2.500000
	Device Accel Adaptive Deceleration (306):	1.000000
	Device Accel Velocity Scaling (307):	12.500000
	Synaptics Edges (327):	1574, 5368, 1408, 4444
	Synaptics Finger (328):	25, 30, 0
	Synaptics Tap Time (329):	180
	Synaptics Tap Move (330):	248
	Synaptics Tap Durations (331):	180, 180, 100
	Synaptics ClickPad (332):	1
	Synaptics Middle Button Timeout (333):	0
	Synaptics Two-Finger Pressure (334):	282
	Synaptics Two-Finger Width (335):	7
	Synaptics Scrolling Distance (336):	112, 112
	Synaptics Edge Scrolling (337):	1, 0, 0
	Synaptics Two-Finger Scrolling (338):	1, 0
	Synaptics Move Speed (339):	1.000000, 1.750000, 0.035417, 0.000000
	Synaptics Off (340):	0
	Synaptics Locked Drags (341):	0
	Synaptics Locked Drags Timeout (342):	5000
	Synaptics Tap Action (343):	2, 3, 0, 0, 1, 3, 0
	Synaptics Click Action (344):	1, 3, 0
	Synaptics Circular Scrolling (345):	0
	Synaptics Circular Scrolling Distance (346):	0.100000
	Synaptics Circular Scrolling Trigger (347):	0
	Synaptics Circular Pad (348):	0
	Synaptics Palm Detection (349):	0
	Synaptics Palm Dimensions (350):	10, 200
	Synaptics Coasting Speed (351):	20.000000, 50.000000
	Synaptics Pressure Motion (352):	30, 160
	Synaptics Pressure Motion Factor (353):	1.000000, 1.000000
	Synaptics Resolution Detect (354):	1
	Synaptics Grab Event Device (355):	0
	Synaptics Gestures (356):	1
	Synaptics Capabilities (357):	1, 0, 0, 1, 1, 1, 1
	Synaptics Pad Resolution (358):	54, 45
	Synaptics Area (359):	0, 0, 0, 0
	Synaptics Soft Button Areas (360):	3471, 0, 4054, 0, 0, 0, 0, 0
	Synaptics Noise Cancellation (361):	28, 28
	Device Product ID (297):	2, 7
	Device Node (296):	"/dev/input/event5"
(22:31:59/11774)~/$ xinput set-prop 15 349 1

Day 807

Google Hangouts highlighting people

If there are too many people with video on, Google Hangouts moves the ones who talk closer to the beginning, making them visible?

Day 805

pycharm/intellij running config environment variables spaces

Got bitten yet again when copypasting them - the name of one of them had four leading tabs. THAT DIDN”T GET SHOWN UNTIL I TRIED TO EDIT THE ENVIRONMENT VARIABLE IN THE PYCHARM WINDOW - it removes them when visualizing. Why? (The parameter of the last one had a trailing space too)

Python negative 0

-0.0 exists as float, and gets stored like this. Though it’s not less than 0 or +0.0. Can’t easily google a way to detect if it’s a negative 0 or not.

Day 803

Signature detection

Random / CLI / CLI task manager / replacement for screen/tmux

GitHub - Nukesor/pueue: Manage your shell commands. (thank you AA)

Day 801

Naming cheatsheet

GitHub - kettanaito/naming-cheatsheet: Comprehensive language-agnostic guidelines on variables naming. Home of the A/HC/LC pattern. (thank you AA)

From it:

Name Prefix Action (A) High context (HC) Low context (LC)
getUser   get User  
getUserMessages   get User Messages
handleClickOutside   handle Click Outside
shouldDisplayMessage should Display Message  

Day 800

Detectron2 dataloader training in parallel num_workers (“process exited unexpectedly”)

When training on different GPUs on the same server, I get errors like RuntimeError: DataLoader worker (pid 30141) exited unexpectedly with exit code 1.

The fix was to set the number of workers to 0: 1


Day 797

Object detection / segmentation metrics & evaluation

From SO: 1

[..]the only difference between mAP for object detection and instance segmentation is that when calculating overlaps between predictions and ground truths, one uses the pixel-wise IOU rather than bounding box IOU.

ROC curve / cutoff point

Finding an optimal cutoff point in a ROC curve is largely arbitrary (or ‘depending on what you need’ based on the actual thing). A lot of ways to find this. (Nice list here, but I’d see if I can find a paper with a good overview: data visualization - How to determine best cutoff point and its confidence interval using ROC curve in R? - Cross Validated)

Detectron2 internals

Nice series of posts on how Detectron2 works inside: Digging into Detectron 2 — part 1 | by Hiroto Honda | Medium

Paper with object detection metrics comparison with the focus on COCO & open source

Electronics | Free Full-Text | A Comparative Analysis of Object Detection Metrics with a Companion Open-Source Toolkit

Untderstanding model performance by looking at examples it got wrong but was confident about

From How to work with object detection datasets in COCO format | by Eric Hofesmann | Feb, 2021 | Towards Data Science:

The best way to build intuition about how your model performs is by looking at predictions that it was confident about but got wrong. With FiftyOne, this is easy. For example, let’s create a view into our dataset looking at the samples with the most false positives

More examples of the same: IoU a better detection evaluation metric | by Eric Hofesmann | Towards Data Science

Day 796

Notes bullet points

In my text notes, I use indentation heavily, but use bullet-point-dashes (-) and just indentation almost interchangeably:

One two
		- six
		- seven
		- eight
	- 12
	- Thirteen

Next part

From now on:

  • Indentation to signal thematic shifts / logical blocks / things following each other chronologically
  • Bullet points for lists and list-like things, where order doesn’t matter

Day 794

Pytorch access GPU tensors from memory

tensor.cpu().numpy() needs to be done when using GPU.

Random / cooking

Паста с морепродуктами в сливочном соусе рецепт – итальянская кухня: паста и пицца. «Еда»

Nvidia tool for GPU/CPU optimization

NVIDIA Nsight Systems | NVIDIA Developer

Found here (a nice article too): Object Detection from 9 FPS to 650 FPS in 6 Steps |

Pytorch multiprocessing

Multiprocessing best practices — PyTorch 1.8.0 documentation


torch.multiprocessing is a drop in replacement for Python’s multiprocessing module

Day 792

Detectron2 run without GPU

If Detectron2 complains about wanting a GPU and finding no CUDA (because there’s none), the script can be set to CPU-only through the settings:

cfg.MODEL.DEVICE = 'cpu'

Detectron2 instances

I should read documentation more often: detectron2.structures — detectron2 0.3 documentation

  • They can be indexed as a mask:
      category_3_detections = instances[instances.pred_classes == 3]
      confident_detections = instances[instances.scores > 0.9]

In general about model outputs: Use Models — detectron2 0.3 documentation

Pytorch converting Tensor to floats

mytensor.numpy() is unsurprisingly easy.

Shapely prepared geometry operations

Shapely geometries can be processed into a state that supports more efficient batches of operations.

(The Shapely User Manual — Shapely 1.7.1 documentation)

Shapely find out if something is a multipolygon:

if joined_boxes.geom_type == 'MultiPolygon': is much cleaner than the isinstance(joined_boxes, MultiPolygon) I’ve been using!

Also - TODO - why is a Polygon that created a MultiPolygon within() it, if `within()..

Returns True if the object’s boundary and interior intersect only with the interior of the other (not its boundary or exterior).

Their boundary should touch, so shouldn’t be valid?

R-tree spatial indexing

Nice (and one of the only..) graphic explanation: R-tree Spatial Indexing with Python – Geoff Boeing

Shapely has a partial implementation: 1

Pass a list of geometry objects to the STRtree constructor to create a spatial index that you can query with another geometric object. Query-only means that once created, the STRtree is immutable.


tree = STRtree(all_geoms)
results = tree.query(query_geom)

In general if I’ll be working more with shapes I should hang out in GIS places to to absorb approaches and terminology. One of R-Tree’s use-cases is say “find restaurants inside this block” which can also be solved by blind iteration (but shouldn’t).

qutebrowser yank selection

Finally got the more familiar keybinding to work, as usual

config.bind('<Ctrl-Shift-C>', 'yank selection')`
config.bind(',y', 'yank selection')

Python dependencies list

johnnydep2 is really cool and visualizes the dependencies of something without installing them (but still downloads them!)

Trash and disk space

Found .local/share/Trash with 33Gb of ..trash in it.

Python dependencies wheel

A .whl file is just an archive, can be unzipped. The entire list of dependencies is in yourpackage.dist-info/METADATA, looks like this:

Requires-Python: >=3.6
Provides-Extra: all
Provides-Extra: dev
Requires-Dist: termcolor (>=1.1)
Requires-Dist: Pillow (>=7.1)

Day 790


..exists, and in general I should pay more attention to the new python versions and their changes.


Ubuntu Manpage: tiffsplit - split a multi-image TIFF into single-image TIFF files

Installs as libtiff-tools, basename can be used as prefix.

Day 789

Inkscape joining (union) of paths

When joining/adding two paths (as in discrete math union) located in different layers, the resulting path will be located in the layer selected when doing the joining.

Inkscape groups

.. are recursive! Grouping two groups works; ungrouping them leads the original two groups!

Day 787

Python multiprocessing/threading basics

From Multiprocessing vs. Threading in Python: What Every Data Scientist Needs to Know


  • Processes: instances of a program being executed; don’t share memory space
    • Slower to create, take a bit more memory and stuff
  • Threads: components of a process that run in parallel; share memory, variables, code etc.
    • Faster to create, less overhead
    • Much easier to share objects between them
  • Race Condition: “A race condition occurs when multiple threads try to change the same variable simultaneously.” (Basically - when order of execution matters)
  • Starvation: “Starvation occurs when a thread is denied access to a particular resource for longer periods of time, and as a result, the overall program slows down.”
  • Deadlock: A deadlock is a state when a thread is waiting for another thread to release a lock, but that other thread needs a resource to finish that the first thread is holding onto.
  • Livelock : Livelock is when threads keep running in a loop but don’t make any progress.

Python / GIL

In CPython, the Global Interpreter Lock (GIL) is a (mutex) mechanism to make sure that two threads don’t write in the same memory space.

Basically “for any thread to perform any function, it must acquire a global lock. Only a single thread can acquire that lock at a time, which means the interpreter ultimately runs the instructions serially.” Therefore, python multithreading cannot make use of multiple CPUs; multithreading doesn’t help for CPU-intensive tasks, but does for places where the bottleneck is elsewhere - user interaction, networking, etc. Multithreading works for places w/o user interaction and other bottlenecks where the tasks are CPU-bound, like doing stuff with numbers.

Tensorflow uses threading for parallel data transformation; pytorch uses multiprocessing to do that in the CPU.

TODO - why does Tensorflow do that?

Python libraries

Python has two libraries, multithreading and multiprocessing, with very similar syntax.

Comparing execution time

Both pictures from the same article above1:

  • One process is slower than one thread always; for more than one, processes win for CPU-only tasks, threads for bottlenecked tasks.
  • More processes than cores doesn’t improve life by much in any case (still better than the same amount of threads though); in the picture, there are four cores.

Python-specific points

  • Easier to make errors in multithreading programs (easier to share data, but you have to keep in mind object synchronisation and race conditions).
  • Threads can’t do true parallelism in Python due to GIL
  • The OS schedules processes, Python schedules threads
  • “Child processes are interruptible and killable, whereas child threads are not. You have to wait for the threads to terminate or join.”

For data science

  • Reading data from disk is I/O bound => multithreading
  • Calculating stuff on CPU/GPU is CPU bound => multiprocessing
  • Storing results => multithreading

Concurrency / parallelism / Python

From Python Multi-Threading vs Multi-Processing | by Furqan Butt | Towards Data Science:

Concurrency is essentially defined as handling a lot of work or different units of work of the same program at the same time.

Doing a lot of work of the same program at the same time to speed up the execution time.

Parallelism has a narrower meaning.

Python - concurrent.futures for multithreading and multiprocessing


import concurrent.futures
with concurrent.futures.ThreadPoolExecutor() as executor:, iterable)

This would create a thread for each element in iterable.

Multiprocessing works in an extremely similar way:

import concurrent.futures
with concurrent.futures.ProcessPoolExecutor() as executor:, iterable)

More about it, as usual, in the docs:

The asynchronous execution can be performed with threads, using ThreadPoolExecutor, or separate processes, using ProcessPoolExecutor. Both implement the same interface, which is defined by the abstract Executor class. 2


Does concurrent.futures have any tradeoffs compared to doing multiprocessing.Pool() like the following?

pool = multiprocessing.Pool(), range(1,10))

Measuring and reading time

Python parallelism example

Parallelising Python with Threading and Multiprocessing | QuantStart has a nice point:

time python

real    0m2.003s
user    0m1.838s
sys     0m0.161s

Both user and sys approximately sum to the real time. => No parallelization (in the general case). After they use multiprocessing, two processes, real time drops by two, while user/sys time stays the same. So time on CPU per second is the same, but we have two CPUs that we use, and we get real time benefits.

Reading and interpreting time output:

Excellent article, copying directly: Where’s your bottleneck? CPU time vs wallclock time

real: the wall clock time. user: the process CPU time. sys: the operating system CPU time due to system calls from the process.

In this case the wall clock time was higher than the CPU time, so that suggests the process spent a bunch of time waiting (58ms or so), rather than doing computation the whole time. What was it waiting for? Probably it was waiting for a network response from the DNS server at my ISP.

Important: If you have lots of processes running on the machine, those other processes will use some CPU.

Reading CPU time ratios

Directly copypasting from the article above, “CPU” here is “CPU Time” (so user in the output of the command), second is “real” (=wall; real-world) time.

If this is a single-threaded process:

  • CPU/second ≈ 1: The process spent all of its time using the CPU. A faster CPU will likely make the program run faster.
  • CPU/second < 1: The lower the number, the more of its time the process spent waiting (for the network, or the harddrive, or locks, or other processes to release the CPU, or just sleeping). E.g. if CPU/second is 0.75, 25% of the time was spent waiting.

If this is a multi-threaded process and your computer has N CPUs and at least N threads, CPU/second can be as high as N.

  • CPU/second < 1: The process spent much of its time waiting.
  • CPU/second ≈ N: The process saturated all of the CPUs.
  • Other values: The process used some combination of waiting and CPU, and which is the bottleneck can be harder to tell with just this measurement.

A bit more about cpu time

  • The user-cpu time and system-cpu time [..] are the amount of time spent in user code and the amount of time spent in kernel code. 3
  • multi-core machines and multi-threaded programs can use more than 1 CPU second per elapsed second 3

Python-specific thread programming:

Day 786

ELIZA chatbot source

This is the script of the DOCTOR program for ELIZA: eliza/doctor.txt at master · wadetb/eliza

SSH port forwarding - you can forward multiple ports!

The -L option can be specified multiple times within the same command. Every time with different ports. 1

Here’s an example:

ssh me@remote_server -L 8822:REMOTE_IP_1:22 -L 9922:REMOTE_IP_2:22

And an even better solution from there, adding this to ~/.ssh/config

Host port-forwarding
  Hostname remote_server
  User me
  LocalForward 6007 localhost:6007
  LocalForward 6006 localhost:6006
  Port 10000

and then just do ssh pf!

Latex color list

A list of all colors in latex supported via the various packages: color - Does anyone have a newrgbcolor{colourname}{x.x.x} list? - TeX - LaTeX Stack Exchange

Day 785

Jupyter notebook - show token

Pressing <Ctrl-C> in a Terminal where jupyter-notebook is running will show a list of running kernels/notebooks, which will include the token:

1 active kernel
Jupyter Notebook 6.2.0 is running at:

mAP (mean average precision) metric

Nice description: Measuring Object Detection models - mAP - What is Mean Average Precision?

TL;DR a way to uniformly calculate results of object detection over an entire dataset, accounding for different thresholds (“my 50% confidence is your 80%). We get such thresholds that recall is 0.1, 0.2, …, 1.0 and then measure precision at these points; take the mean.

A bit more details: rafaelpadilla/Object-Detection-Metrics: Most popular metrics used to evaluate object detection algorithms.

Day 784

Force unmount / umount

One can use mount without arguments to get the list of mounted filesystems! o

Killing anything that uses a directory:1

fuser -kim /address  # kill any processes accessing file
unmount /address

(-k is kill, -i is “ask nicely before killing”)

Reproducibility / configs / experiments / yacs

rbgirshick/yacs: YACS – Yet Another Configuration System is a “lightweight library to define and manage system configurations, such as those commonly found in software designed for scientific experimentation”. It’s used by detectron2, serializes configs in yaml files. Nicely supports standard settings and experiment overrides and CLI overrides. Basically what I’ve been trying ot hack together in some of my scripts.

Detectron2 error with test set when none set.

Got: FileNotFoundError: [Errno 2] No such file or directory: 'datasets/coco/annotations/instances_val2017.json at the end of trainings.

Solution was to have cfg.DATASETS.TEST = () explicitly set, not commented out like I had. 2

so it’s a mystery why cfg.DATASETS.TEST is looking for datasets/coco/annotations/instances_val2017.json


Detectron2 evaluation

Example of how to use EvalHook to run functions: detectron2/ at master · facebookresearch/detectron2 (but I’d like to implement the eval as a subclass)

Day 783

Python to read

Python path / pathlib

The python3 way to work with paths seems to be pathlib — Object-oriented filesystem paths — Python 3.9.2 documentation, not the old os.path.*

Split is Path (close to really-existing things), and PurePath - abstract paths, without connection to any real filesystem.

Day 779

Python working with shapes

Shapely is awesome! And easy to play with in jupyter notebook

SSH port forwarding for tensorboard/jupyter

To access a Tensorboard (..or anything) running on a remote server servername on port 6006: ssh -L 6006: me@servername

After this, tensorboard is bound to the local port 6006, so

Tensorboard has to be run with --host= to make it accessible from outside.

Jupyter - the link with the token can simply be followed (or copypasted), if the port is the same in both localhost and server.

Day 777

matplotlib/pyplot invert/reverse axis

Unsurprisingly intuitive:

ax.set_ylim(1, 0)

(of course, problematic if you don’t know your actual limit)

EDIT Mi 10 Mär 2021 19:23:20 CET: There’s an even better solution! 1


Install pytorch on CUDA 10.0 + verify torch/cuda installation

Pytorch officially doesn’t do CUDA 10.0.x, but I found this, worked perfectly: How to Install PyTorch with CUDA 10.0 - VarHowto

Installing: pip install torch==1.4.0 torchvision==0.5.0 -f

Testing installation and GPU:

import torch
x = torch.rand(5, 3)


Day 776

Dotfiles over multiple servers

Nice discussion: How do you manage your dotfiles across multiple and/or new developer machines? - DEV Community

This article also provides a really nice explanation of the general practice that many people seem to be taking: store dotfiles in GitHub, and then install them via a simple script that symlinks files and runs any additional init logic.

Day 773

NewPipe youtube music

… not that I’ve ever used it or plan to (google, don’t ban me before I finished switching to FastMail!), but - NewPipe supports searching and playing videos from Youtube Music!

Serial-position effect (memory)

Serial-position effect “is the tendency of a person to recall the first and last items in a series best, and the middle items worst”. Related is the Von Restorff effect about the most different stimuli being easier to remember.

Day 772

Setting up the touchpad

.. never used it because didn’t find it pleasant to use because no scrolling and clicking as I’m used to, but I can fix this! Google told me I should install synaptics stuff and use synclient to config it, but..

(21:30:13/11094)~/$ synclient
Couldn't find synaptics properties. No synaptics driver loaded?

Google led me here: x11 - synclient does not find synaptics properties despite Synaptics Touchpad in xinput list - Unix & Linux Stack Exchange

So in fact the “problem” is that touchpads is nowadays handled by libinput, not by synaptics. This is why xinput still lists the device, but synclient cannot find it.

The touchpad properties can also be controlled using xinput, via xinput list-props and xinput set-prop

Which works! xinput set-prop $device $propID $value, where the property id is given in parentheses in xinput list-props output: ` libinput Tapping Drag Enabled Default (330): 1`

So I (in case gets reset after restart):

xinput set-prop 15 327 1 #enabled tapping
xinput set-prop 15 312 0 1 0 # scroll through side of touchpad

Interestingly, xinput set-prop 15 312 1 1 0 didn’t work, apparently I have to choose one. (Same for “click methods”)

Now we pray the xorg/synaptics drivers I installed at the beginning don’t mess up everything after restart ^^ I followed this: How to Activate Two-Finger Scrolling in Ubuntu 18.04 LTS

More advanced settings for libinput

The ArchWiki is excellent as usual. TIL a tap with three fingers is a shortcut for “paste” and you can change/remap that as everything else! Wow.

TODO - play with buttons and three-taps and two-taps and the physical buttons. Also, where does it define that button N is “paste”? And which clipboard are we talking about?

And - I can do it with my usb mouse!

Day 771

Day 770

Python parameter unpacking

Extremely helpful answer: Revisions to Passing a dictionary to a function as keyword parameters - Stack Overflow

I also really like this approach:

A few extra details that might be helpful to know (questions I had after reading this and went and tested):

  1. The function can have parameters that are not included in the dictionary
  2. You can not override a parameter that is already in the dictionary
  3. The dictionary can not have parameters that aren’t in the function. Examples:

(Connects with my long-forgotten way of ‘after reading something, ask questions, try to find faults, try to find places this isn’t going to work, try to find connections with stuff you already know, try to find contradictions with stuff you already know’ etc., I have to start doing this again)

Make jira use less whitespace

Main culprit is this code, and changing that value to anything makes life better:

.adg3 .issue-container {
	max-width: 1280px;

qutebrowser cycle through css / custom css

This line toggles between solarized-everything1 and the above snippet for making jira wide again.

config.bind(',c', 'config-cycle content.user_stylesheets "~/.config/qutebrowser/css/solarized-dark-generic.css" "~/.config/qutebrowser/css/jira.css"')

Sadly no automatic per-website-css possible yet, it seems.

alphapapa/solarized-everything-css: A collection of Solarized user-stylesheets for…everything?

Day 769

Updated xrealpath to not include newline

echo -n "string" makes echo not add a newline symbol at the end 1. So anything | xargs echo -n | removes that.

Final command is

xrealpath() {
    realpath "$1"
    realpath "$1" | xargs echo -n | xc

Day 765

Day 764


Had issues with NoiseTorch microphone not working, fixed by changing the microphone and then back. (…) While I’m at it, updated NoiseTorch, and added this snippet to the polkit config to not-enter passwords: I don’t want to enter my password everytime · lawl/NoiseTorch Wiki


Still exists and still works!

  • sshfs me@server:/some/folder /my/local/folder -p 12345
  • umount /my/local/folder \ Can be used to permanently mount stuff through fstab

An insecure faster version is: sshfs -o Ciphers=aes128-ctr -o Compression=no me@server:/some/folder /my/local/folder -p 12345

(In my case, most of my lag was from zsh git prompt plugin, removing it made it much faster)

arandr change monitor settings to get it recognized

When a monitor stops working, sometimes it is fixed by deactivating/applying/activating/applying in arandr, or doing any changes to it intead of deactivating it. I’ve been changing its resolution, but to maximally preserve the layout, just inverting it (and back) works too!

Day 763

nomacs for files over ssh

Nomacs is extremely slow when viewing images located on a remote server, any other viewer works for me. The default one is eog / “Eye of Gnome”

Python investigate memory leaks

tracemalloc is part of the python standard library!

This snippet from the docs1 has everything:

import linecache
import os
import tracemalloc

def display_top(snapshot, key_type='lineno', limit=10):
    snapshot = snapshot.filter_traces((
        tracemalloc.Filter(False, "<frozen importlib._bootstrap>"),
        tracemalloc.Filter(False, "<unknown>"),
    top_stats = snapshot.statistics(key_type)

    print("Top %s lines" % limit)
    for index, stat in enumerate(top_stats[:limit], 1):
        frame = stat.traceback[0]
        print("#%s: %s:%s: %.1f KiB"
              % (index, frame.filename, frame.lineno, stat.size / 1024))
        line = linecache.getline(frame.filename, frame.lineno).strip()
        if line:
            print('    %s' % line)

    other = top_stats[limit:]
    if other:
        size = sum(stat.size for stat in other)
        print("%s other: %.1f KiB" % (len(other), size / 1024))
    total = sum(stat.size for stat in top_stats)
    print("Total allocated size: %.1f KiB" % (total / 1024))


# ... run your application ...

snapshot = tracemalloc.take_snapshot()

Day 762

Intellij idea commit keybinding

Added <Shift+Alt+C> for “commit”, since <Ctrl+K> doesn’t work (and afaik is not used for anything else). (<Ctrl+Shift+C> is still “copy path”)

Day 759

Intellij idea / pycharm global bookmark a line in the file.

<Ctrl-Shift-#> (where ‘#’ is 1-9) adds named bookmarks to lines in the file; <Ctrl-#> to go there. (It’s logical to make it easier to go to a bookmark than to set one, given that the former should happen more often). Complements nicely ideavim’s m# bindings.

These bookmarks are global.

Intellij idea switch to tab numbers + moving tab + plugings + random keybindings

In the description of the plugin GoToTabs: Now it’s supported natively through keymap->other->tabs! Can’t get tab 2 to work, but I couldn’t do this with bookmarks either, something is catching that binding before it gets to intellij?

Also in idea you can map numpad numbers - I could remap them for bookmarks.

TODO make a backup of my keymap.

And - there’s TabNumberIndicator, that adds the Alt+# bindings and shows the tab number in the tab! Exactly what I wanted.

  • Added <Ctrl+,> for moving the tab left though MoveTab plugin.

EDIT - argh, I knew I needed these Alt+# bindings. TODO change them to Ctrl+Alt+… or similar.

copying a python virtualenv

virtualenv-clone is the package, syntax is 1

python -m clonevirtualenv source/ target/

Day 758

Collision detection of boxes / patterns

This is brilliant: collision detection - What is the fastest way to work out 2D bounding box intersection? - Game Development Stack Exchange

return !(r2.left > r1.right
    || r2.right < r1.left
    || < r1.bottom
    || r2.bottom >;

The idea is to capture all possible conditions upon which the rectangles will not overlap, and then negate the answer to see if they are overlapped

Originally from here: Rectangle Intersection – Determine if two given rectangles intersect each other or not « Technical Interview Questions

Doing it straight-forwardly would require more conditions.

Surprisingly intuitive and shows once more that when finding the answer is too hard, trying to find the answer to an opposite question might help you out.

python moving virtualenv makes it use the system default python/pip paths

Python venv (virual environment) uses wrong version of Python - Stack Overflow:

As an addition to the accepted answer, be also aware that changing the directory name where your venv is located causes using the default python and pip paths of your system, instead of using the venv one.

This explains so much!

To make an existing virtualenv movable

not included in the new venv. :( 1

No easy official way, reinstalling is much easier.

To find out where a certain package is installed, pip list -v.

Basic Slack bot

import os
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError

client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])

    response = client.chat_postMessage(channel='vision-trainings', text="Hello world!")
    assert response["message"]["text"] == "Hello world!"
except SlackApiError as e:
    # You will get a SlackApiError if "ok" is False
    assert e.response["ok"] is False
    assert e.response["error"]  # str like 'invalid_auth', 'channel_not_found'
print(f"Got an error: {e.response['error']}")

Intellij idea applying only some changes from commit in another branch

Find that branch in git log, right click on the file(s) you want, “Apply selected changes”. 2 (“Cherry-pick selected changes” according to Help)

matplotlib add colorbar

fig = plt.figure(figsize=(20, 15))
ax = plt.subplot(132)

#plt.gcf().tight_layout(rect=[0, 0, 1, 0.90])

cbar_ax = fig.add_axes([0.92, 0.10, 0.04, 0.8])
if heatmap is not None:
	fig.colorbar(heatmap, cax=cbar_ax)

Confluence page info

Shows incoming and outgoing links, useful to look for other places with similar info.

Day 757

Pycharm / Intellij idea debugging

  • If I highlight/select code before opening the window with <Alt-F8> that code is automatically written there!
  • I should use <Shift+Alt+9>/”Run to cursor” more often
  • I should remember that “scroll to end” exists and should be usually on

Different OCR engines comparison

The Battle of the OCR Engines - Tesseract vs Google Vision | Blog | Fuzzy Labs - really nice! Compares three modes of Tesseract and two Google Vision. TODO add to /f/

timewarrior input time

Timewarrior accepts time the way I usually write it in my notes! timew track 1520 - 1600 stuff just worked!

Day 756

Design / pytorch / ux

I find the “Install pytorch” thing on the pytorch website really nice. You click things and it gives you a command.

CLI program guidelines, to read

Command Line Interface Guidelines - thank you AA “An open-source guide to help you write better command-line programs, taking traditional UNIX principles and updating them for the modern day.”

Day 755


New strategy - use only German, look up any grammar stuff I have to, and add the things I have to look up to anki. (Just realized I’m googling whether it’s “dir passt” or “dich passt”, it’s 10/10 an use-case flashcards).

Google colab

.. is really awesome! I should spend some time getting to know it. Example:

Day 752

ssh via public key permissions

Broke log-in to an external server I have access to by attempting to use ssh-copy-id me@server, after which it still wanted my password but once inputted correctly didn’t start the shell. (Though showed the motd).

Day 750

English / Slack

Unfurl | Definition of Unfurl by Merriam-Webster - “expand, extend, fan (out), flare (out), open, outspread, outstretch, spread (out), stretch (out), unfold”

Fastmail calendar

Things I love so far:

  • Can move/change single recurring events without issues, asks whether to do it for one or all of them only when I use the “Edit” button! Things I miss:
  • Ability to “copy” an event in another calendar. Though I consider the need to do this an antipattern, and maybe I’ll find a workflow where I don’t need to do this often.

German / Deutsch

das Teufelszeug - appalling/hellish/infernal stuff (heard at work)

python console vim editing mode!

I so missed this. Adding to ~/.inputrc this line:

set editing-mode vi

makes all readline programs use vi mode, including Python interactive console. Wow.

Alternatively, this apparently works too when typed into python console:

import readline
readline.parse_and_bind("set editing-mode vi")


Athame (readline replacement with complete vim support)

ardagnir/athame: Full vim for your shell (bash, zsh, gdb, python, etc)

One can install it in place of the usual readline locally or globally.

Installed for zsh, now I can use ci( bindings again!

Day 749

.vimrc conversion saga

In Day732, I changed my ./vimrc to utf8 from latin-1, to be able to use the “” symbol to mark trailing spaces.

Well, it broke the vim macros for the link wiki (from Day 450) :( I had the latin version of the .vimrc backed up, falling back to it for now.

I need to think of a way to save these macros better, because even copypasting them to this dtb didn’t work and I had to do text encoding magic. I think this is exactly the time one should use a proper scripting language like Python, and write another small qutebrowser script that changes the contents of the filled textarea.

link links to pages, post_url links directly to posts inside _posts.

Link to pages:

{% link _collection/ %}
{{ site.baseurl }}{% link _collection/ %}
{{ site.baseurl }}{% link _posts/ %}
{{ site.baseurl }}{% link services/index.html %}
{{ site.baseurl }}{% link /assets/documents/pal-codes.pdf %}

Links to posts:

{% post_url %}
{{ site.baseurl }}{% post_url %}
{{ site.baseurl }}{% post_url /folder/ %}

Copied directly from this excellent page, I never found this explained in such a readable way: How to create internal links in Jekyll | Web Island Blog

TODO Jekyll / dtb / meta

Write a small script that allows me to easily link to days just by their day number.

Jekyll changed post permalinks

Before URI contained the date and was hard to link to. Now I changed this in _config.yml:

permalink: :title:output_ext

Links are now like this:

Python representing infinity

float('inf') works for floats, but there’s no way to do it with ints. math.inf is also a float. 1

vim interrupt operation via <Ctrl-C>

Made a typo, vim attempted to indent 20k lines (and started counting “xx lines to indent…”, intuitively pressed <Ctrl-C>, it successfully interrupted the operation!

Day 748

matplotlib reverse colormaps

Every colomap has a reversed version named *_r (such as gray_r)! 1

Papers - NLP - Chargrid

[1809.08799] Chargrid: Towards Understanding 2D Documents

Day 747

Fastmail shortcuts

Keyboard shortcuts | Fastmail

Qutebrowser passthrough

Simplified bindings for passthrogh, added last line to ~/.config/qutebrowser/

config.unbind('<Shift-Escape>', mode='passthrough')
config.bind('<Ctrl-Shift-+>', 'leave-mode', mode='passthrough')
config.bind('<Shift-I>', 'enter-mode passthrough')

Would allow me to use websites’ own shortcuts more often.

Day 745

Day 744

python serialization using dill

dill is like pickle, but serializes more stuff!

python pycharm unittest

Yet another way one can get the “no tests to run” error - if a test is not called test_..., it won’t be ran.

Day 742

i3 sticky window / pin window

It’s easy to do a sticky window in i3!

Added to ~/.config/i3/config:

# Sticky window
bindsym $ms+p sticky toggle

Seaborn catplot titles (plotting, pandas, visualization)

Seaborn anonying facet title · Douglas C. Wu:


The set_titles(col_template='{col_name}') removes the usual “x=y” title in each of the sub-plots!

Day 741

qutebrowser crashing

Yet another time qtbrowser started crashing, yet another time fixed it by removing state and sessions from ~/.local/share/qutebrowser/. I blame me messing with qt versions last week.


Somehow magically I don’t have to escape anything in the regexes when using it!

ag "(VISION_|short)" *

passing empty parameters to python argparse / cli?

python - Passing empty string to argparse - Stack Overflow:

python --mode=

I’ve been using args a la -w is, but -w=is also works, and therefore python3 -w -another=opt is perfectly valid! Python parses it as empty string (that casts to False).

fc linux meaning

TIL fc stands for “fix command”!

vim s/ replacing stuff

Discovered that if you just want to remove something, %s/from works (without the second // part at all)

Day 738

pycharm optimize imports

Auto import—PyCharm

python argparse

Seems the best current default way to do cli options! Docs tutorial is as accessible as usual: Argparse Tutorial — Python 3.9.1 documentation

parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) # show default args in help
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) # allow newlines in help text
parser.add_argument("-lp", "--localpath", help="Local path. \n %(default)s", default=local_path) # add default text in help text manually

Python shadowing modules

When creating, don’t be surprised if you can’t use argparse from import argparse. 1

Python to read, TODO

Nice article: PyFormat: Using % and .format() for great good!

ag as grep alternative for code

I should make an effort to learn it and use it. ag -G "component.*yaml" regex - searches for regex inside all files whose path matches the regex after -G

ag --python "myregex" automatically looks for it in all python files, and really nicely outputs matches!

vim delete lines not containing a pattern

g!/pattern/d, as opposed to the usual g without exclamation mark.

Using less to copy cli stuff with weird linebreaks

If command returns output with newline breaks that are ignored when copypasting directly, using command | less seems to make it work - I can copypaste from there without problems.

Day 737

Change volume of bluetooth headphones via cli / pactl

I wasn’t able to do it the usual amixer way, because:

You are running Pulseaudio, which uses ALSA to drive soundcards, but which connects to Bluetooth speakers without involving ALSA. When you set ALSA volumes with amixer, Pulseaudio notices and corrects the source/sink volumes[…] 1

Command to do it directly through pulseaudio is: pactl set-sink-volume name_of_bluetooth_speaker +3%

Added this to ~/.config/i3/config:

bindsym Mod1+r exec  pactl set-sink-volume bluez_sink.60_AB_D2_43_E9_C5.a2dp_sink +5%
bindsym Mod1+c exec  pactl set-sink-volume bluez_sink.60_AB_D2_43_E9_C5.a2dp_sink -5%

Nomacs picture viewer remove animations + frameless

  • Changed transition time to 0 in Settings -> Display -> Slideshow
  • <F10> leaves only the current picture (‘frameless’), a la scrot; Though in this mode drag-n-drop doesn’t work!

zsh text colors list

Found this when autocompleting something else:

(12:36:26/10136)~/ $ which spectrum_ls
spectrum_ls () {
	for code in {000..255}
		print -P -- "$code: %{$FG[$code]%}$ZSH_SPECTRUM_TEXT%{$reset_color%}"

Returns 255 lines with 255 colors, they look neat:


To read - matplotlib

TODO: The Many Ways To Call Axes In Matplotlib | by Jun | Towards Data Science And in general

Day 736


das wasserzeichen - Watermark! (Heard at work) die dringlichkeit - urgency. “Besondere Dringlichkeit”. Verschiedene Dringlichkeiten. (heard at work)

Bluetooth / Linux

blueman is a nice semi-gui suite for everything. bluetoothctl is an interactive cli.

Linux - remove noise from microphone with Noisetorch

lawl/NoiseTorch: Real-time microphone noise suppression on Linux. - creates virtual devices that are the same as inpucts, but filter the noise. Works really well for me! (Single binary). Works also for filtering voice in outputs! Listening to songs through it is weird.

taskwarrior zsh sprint env variable

Changed date format from %+V to just %V, which gives a sprint like 01 instead of 1 (which in turn removes the need for filtering in taskwarrior, now sprint:01 is a unique identifier)


export SPRINT=$(date +%V)

Day 735

matplotlib pyplot make certain color transparent

For this, a subset has to become bad values, and a cmap has to set what to do with them.

my_cmap = copy.copy('gray')) # get a copy of the gray color map
my_cmap.set_bad(alpha=0) # set how the colormap handles 'bad' values
plt.imshow(thing, cmap=my_cmap)


As for bad values, I wrote a function similar to this to make them arbitrary:

def get_bad_values(matr, value=0):
	new_matr = matr.astype(np.float)
	new_matr[new_matr == value] = np.nan
	return new_matr

Note that np.nan can only replace a np.float, never an int!

Day 734

Updated i3 config for toggling between modes

Made everything simpler, based on what I usually really need:

bindsym $ms+s layout toggle tabbed stacking
bindsym $ms+Shift+s layout toggle split

TODO - something for “focus tab N in currently focused container”, a la what I have in qutebrowser/intellij.

Yearly dtb ritual of updating year

.. TODO - fix this, finally. +DAY=$(((365)*2+10#$(date +%j)))

ideavim splitters

Added this to ~/.ideavimrc for moving between splits

map <leader>h :action PrevSplitter<CR>
map <leader>l :action NextSplitter<CR>
map <leader>o :action MoveEditorToOppositeTabGroup<CR>

Day 733

record terminal on linux with script

The script utility exists, and is installed by default on at least two systems I have access to. Works really well for interactive sessions!

script --timing=time.txt script.log
scriptreplay --timing=time.txt script.log

Seems to work when ran through screen, even when the screen is detached!

How to Record and Replay Linux Terminal Sessions using ‘script’ and ‘scriptreplay’ Commands

output terminal live on another screen

This is really cool: command line - How to have a terminal mirrored onto a second screen in a two-monitor setup? - Ask Ubuntu

script -f /tmp/lecture1.scrpt
tail -F /tmp/lecture1.scrpt

-f is for “Flush output after each write.” (as opposed to “write everything to the file when script is terminated”)

Day 732

Markdown newline inside quote

Couldn’t understand why there are newlinen in my yearly review blog post from last year. So - in markdown, two spaces and then a line break create a line break.

So, like this:

Fine, no spaces Six, no spaces

Highlight to see spaces:

So, like this:  

> Three  
> Four  
> Fine, no spaces
> Six, no spaces

vim show trailing whitespaces

In connection to the above, yes. Updated ~/.vimrc with the following:

set listchars=tab:\:\ 
set listchars+=trail:◦

Looks like this:

vim CONVERSION ERROR - convert file to different encoding / save with other encoding.

For the above had to convert my ~/.vimrc to utf-8, not the default latin-1:
:w ++enc=utf-8

vim insert utf-8 characters

i3 keybinding to make a screenshot and put it into jekyll assets directory

This makes a screenshot as usual, opens it, opens the jekyll dtb assets folder, and puts the screenhsot name in the primary clipboard. I look at the screenshot, if I like it - I drag it directly to the folder, then use the vim/jekyll binding to insert it in the markdown.

bindsym Mod3+Shift+s --release exec scrot -s -e 'mv $f ~/s/screenshots && nomacs ~/s/screenshots/$f & echo -n $f | xclip -selection c && thunar ~/o/dtb/assets/pics/screenshots/'

echo -n is echo without newline (otherwise it gets fed to xc with newline appended). Added to ~/.config/i3/config.

Feels incredibly ugly and unstable but works for me I guess. Ideally it’s long enough to be replaced with a bash script, but not sure it’s worth it. But if I end up doing more of these, I’ll create a one custom big parametrized bash script that I’ll call like ./ screenshot.

vim jekyll binding to insert screenshot picture

map <leader>p i![](<esc>pa)<esc>0lli in ~/.vimrc

Inserts a picture with filename from primary selection, then goes back to the description. Used with new i3 screenshot keybinding from above. a in vim is “insert from next character”, so like A but with words.

I really do need to use a/e etc in vim more often.

camel / snake / kebab notation, note to self.

I seem to use more of-this-notation lately, instead of this_notation. Formalize this, not just for consistency, but to use this to my advantage - vim and company see these-words as separate, and this_word as one.

bash echo without newline at the end

echo -n doesn’t add a newline. Especially useful combined with xclip.

Day 730


WKD - Matsuo Basho Archives: - Timeline -:

1662 or 1663 寛文二年
His first known hokku at age 19:

haru ya koshi toshi ya yukiken kotsugomori

has spring come
or has the year gone?
Tr. Barnhill

what is spring that came
or was it the year that went?
the Second Last Day
Tr. Ueda

Ist das Frühjahr gekommen
oder das Jahr vergangen?
Der vorletzte Tag.
Tr. Udo Wenzel

The Ukrainian translation seems imprecise, but still remains my favourite: Аніяких думок не лишилось в моїй голові наприкінці року!

Чи вже про весну, чи про минулий рік думати? Передостанній день року.

Переклад Геннадія Туркова


Послание к Римлянам 13:4 – Рим 13:4:

ибо начальник есть Божий слуга, тебе на добро. Если же делаешь зло, бойся, ибо он не напрасно носит меч: он Божий слуга, отмститель в наказание делающему злое.

Послание к Римлянам 13:4 – Рим 13:4:

Day 728

Taskwarrior / zsh

Updated zsh alias to include non-work tasks tagged +A or +O from current sprint:

s () {task s \(project:w or \(sprint:$(date +%-V) \(+A or +O\)\) \) "$*"}

or has to be lowercase, brackets in taskwarrior’s filtering have to be escaped.

Google sheets linking between spreadsheets

Use a formula like this:

=IMPORTRANGE("", "Sheet1!A:A") 1 For me it was ; as separator; may need to confirm connecting sheets.

Day 723

Day 722


Changed colour of +F tasks to a better shade of gray in .taskrc

# color.tag.F=color239

Show all available terminal colors

curl -s | bash

(yay for curl | bash!)


  • Slashes
  • der Schrägstrich - forward slash (/)
  • umgekehrter Schrägstrich - backslash (\)

TODO - all German IT words in one place, and add them to Anki

Intellij idea structural search and replace

Structural search and replace examples—IntelliJ IDEA is neat! Templates are like this:


Note the “target”, usually it’s set to a complete match, but by call and by params exists too.

I had to disable ideavim, because it was doing some weird formatting by itself with brakets and indents that broke checkstyle.

Filters are also important - $params$ will catch only what.function("one"), but won’t what.function(one, two) - had to change count to be [1, +inf]. (1, not 0, because I needed to avoid replacing what.function().)

“Expression cannot be replaced by non-expression” - if you add a ; at the end of the template, it’s an expression now, and the replacement also needs a ; now.

Java “do nothing” instruction (a la pass)

; works! 1 A bigger one that makes checkstyle happy is assert true;

Random / cooking

Day 721


  • vorkauen -> pre-chew (or “explain with crayons” metaphorically)
  • die Achillesferse - Achilles’ heel

Day 718

Google Meet

“Pinning” a screen makes it only big screen you see.

Day 717


Day 716

grep escaped quotes without quotes

It’s possible not to use quotes if have just escaped stuff.

grep "\"Thinker" == grep \"Thinker

Til - decompression bomb

After finding a weird error in PIL, found this: Decompression bomb protection · Issue #515 · python-pillow/Pillow

Zip-bombs live on and prosper it seems :)

Day 715

ncdu / ncurses interface to list big directories

ncdu is a little neat program that first scans all the subdirectories of the current one and returns a nice visual navigable list.

d to delete selected folder, ? for help.

zip recursively excluding folder or some files

zip -r ./ -x 'unscoped/*'

-x is a regex of files to exclude. 1


dankbare aufgabe - “rewarding task”

Diff two folders

diff -rq folder1 folder2 diffs contents of files inside the two folders.

Daff diff epsilon

daff diff can accept a -d parameter giving an epsilon, changes of numbers smaller than eps won’t be shown in the diff!


screen -r seems to accept not just the full name of the screen to attach, but even just the first letters!

Day 714

Day 711


Started to crash suddenly. git pull-ing didn’t help, but it and recreating the virtualenv using scripts/ did.

Day 708


der werkzeugkasten - toolbox/kit

vim foldignore with foldmethod tab

This makes empty newlines be part of the fold: 1

" Ignore empty lines when using tabfold
:set foldignore=#<CR>

jq sorting

.. exists and works. 2


Day 706

Day 704

maven version ranges

(Also used in input of some other internal tools) They are: 1

Range	Meaning
1.0	x >= 1.0 * The default Maven meaning for 1.0 is everything (,) but with 1.0 recommended. Obviously this doesn't work for enforcing versions here, so it has been redefined as a minimum version.
(,1.0]	x <= 1.0
(,1.0)	x < 1.0
[1.0]	x == 1.0
[1.0,)	x >= 1.0
(1.0,)	x > 1.0
(1.0,2.0)	1.0 < x < 2.0
[1.0,2.0]	1.0 <= x <= 2.0
(,1.0],[1.2,)	x <= 1.0 or x >= 1.2. Multiple sets are comma-separated
(,1.1),(1.1,)	x != 1.1

Day 702

Python ast literal_eval

literal_eval - ast - Python documentation - Kite

Safely evaluates Python expressions, nice to use for input.

may only consist of the following Python literal structures: strings, numbers, tuples, lists, dicts, booleans, and None.

jq colours

To pipe output with jq to for example less preserving the colours, use -C. (Simialar to --color=always etc.)

jq . $filename -C | less

Day 697

Zsh prompt change based on dev/prod

The script that sets dev/prod sets a variable to 1 if using dev. Based on that variable I get (or not) a red (B) in my zsh prompt.

Did these changes to the theme clean2.zsh-theme:

PROMPT='%{$fg[green]%}(%*/%!)$ZSH_USING_DEV%{$fg[$NCOLOR]%}%B%b%{$reset_color%}%{$fg[blue]%}%B%5c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '

if [ "$USING_DEV" = "1" ] 

and in ~/.zsrhc

alias uc='. ~/s/ p'
alias ud='. ~/s/ d'

zsh prompt export variables from a script

Using the usual ./ way doesn’t work!

Note the . ~/s.. in the script above. Running it as ~/ will create a new shell, export the new values there, and close it. Starting with a . will make it run the script without starting a new shell. 1

Day 696

Confluence tabs + publishing

“Publish without notifying watchers” exits.

If I paste something from vim that has tabs in it in a Code block, in the Edit window it will look fine, but won’t at the end. Editing again will make it again look fine in the edit window. Moral: use spaces.

vim tabs

If you copypaste things from it to code blocks in jira/confluence it will start being weird. You can do expandtabs/retab to convert it to something that looks just like this with spaces when saved. Though feels suboptimal.

Day 695

Multiple monitors / productivity idea

If I have a laptop and two external monitors, put the ‘distracting’ things on the laptop monitor and close the laptop. Open it when I’m officially doing a pause.

My aliases for grep and history

I shouldn’t forget that I have g aliased to grep, along with h to history | grep. Just tried this and it works:

h vim | g http

zsh expand all aliases; zsh keybindings; zsh show all files in directory

Added this 1 to ./zshrc:

expand-aliases() {
  unset 'functions[_expand-aliases]'
  (($+functions[_expand-aliases])) &&
    BUFFER=${functions[_expand-aliases]#$'\t'} &&

zle -N expand-aliases
bindkey '^E' expand-aliases

^E is <C-e>. Gets run anytime I use it, without connection to the written text. Neat.

Also found this in ./.zshrc:

# Usage:
#   In the middle of the command line:
#     (command being typed)<TAB>(resume typing)
#   At the beginning of the command line:
#     <SPACE><TAB>
# Notes:
#   This does not affect other completions
#   If you want 'cd ' or './' to be prepended, write in your .zshrc 'export TAB_LIST_FILES_PREFIX'
#   I recommend to complement this with push-line-or edit (bindkey '^q' push-line-or-edit)
function tab_list_files
  if [[ $#BUFFER == 0 ]]; then
    BUFFER="ls "
    zle list-choices
    zle backward-kill-word
  elif [[ $BUFFER =~ ^[[:space:]][[:space:]].*$ ]]; then
    zle list-choices
    [ -z ${TAB_LIST_FILES_PREFIX+x} ] && { BUFFER="  "; CURSOR=2; }
  elif [[ $BUFFER =~ ^[[:space:]]*$ ]]; then
    BUFFER="cd "
    zle list-choices
    [ -z ${TAB_LIST_FILES_PREFIX+x} ] && { BUFFER=" "; CURSOR=1; }
    zle expand-or-complete || zle expand-or-complete || {
      BUFFER="ls "
      zle list-choices

zle -N tab_list_files
bindkey '^I' tab_list_files

<C-i> gives a list of files in the directory, and space-space-tab at the beginning of the line too. <C-q> (push-line-or-edit). More about it here: TIL: save half-typed commands in bash and zsh « Serge Gebhardt ( TL;DR remove command currently being edited and paste it at the next Return.

Day 694

German / English / slang

Seen in the wild at work: ASAPST - like ASAP, but even more urgent. 1

Linux multiple cameras/webcams

Just found this hack: if the program you want to use doesn’t pick the right camera and you can’t control that through settings, open another program that will use the wrong camera - the first program will pick the first free camera, the one you want.

Day 693

Jira formatting

Didn’t know that underline is marked +like this+. Why can’t we just agree on a flavour of markdown :(


Changed my main dtb log file from using spaces to using tabs. 1

:set tabstop=2      " To match the sample file
:set noexpandtab    " Use tabs, not spaces
:%retab!            " Retabulate the whole file

Added set listchars=tab:\:\ to vimrc. NB space at the end.

Day 689

vim open multiple files via stdin

When trying to do this: find | grep \/model | grep descr | xargs vim -p it opens all files in different tabs as wanted, but breaks the terminal afterwards (need to reset it).

intellij idea tests “No tests found matching Method”

Sometimes I see it and randomly restart and somehow it goes away, today it didn’t.

The usual ‘Invalidate Caches & Restart’ didn’t fix it for me. BUT I had forgotten to annotate it as @Test.

Other ideas about this from StackOverflow: 1

  • run the entire suite, not just that one test
  • If you rename the test it may use the last working running configuration that will fail

Jira markup - indented bullet points / subpoints

Uses asterisks, not indentation.

* I am a bullet point
** I am related to the first one

Day 687

Intellij idea ‘for’

Didn’t notice it before, but Idea shows the beginning condition of the loop when it’s outside the screen and cursor is on it’s closing braket.

TODO vim

Write something that: a) pastes multiline things automatically at the correct indentation b) copies URIs alone, without leading tabs/spaces. As a bonus - copies only the URI at a certain line without anything else. (I believe I can use kitty for this too, need to look into hints again)

Day 686

screen attach a screen that is ‘attached’ after connection drop

The magic formula I used in the irssi days for all cases works here too: screen -raAd $n

screen scrollback

To change it during runtime, <C-A>:scrollback $number. Otherwise ~/screenrc:

defscrollback 1000000


You can drag-n-drop files from the OS to a folder in nextcloud web gui, and it will automatically upload the file directly there (and inherit all permissions)

Day 683

Linux disable and reenable laptop keyboard

xinput -list

Note the id of “AT Translated Set 2 keyboard” (14 in my case), it’s the laptop keyboard, and of the one labeled “master keyboard” (3 in my case). xinput float $id and xinput float $id $id-master. 1

xinput float 14         #disables laptop keyboard
xinput reattach 14 3    #enables it back

ssh keys (id_rsa,

Errors like:

Permissions 0644 for '/home/me/.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.

can be fixed by setting the permissions to 400.

Java complaining about --add_opens + $JAVACMD

For some reason the script took java8 instead of the java11 returned by which java, through $JAVACMD. Temporarily fixed by doing JAVACMD="/usr/bin/java" ./

Day 682

linux screen

If you leave screen in copy mode and detach, it’ll be in copy mode when you attach it back and give the impression that no new output happened from the time you detached it.

Day 681

German ‘alle’ deklination, singular/plural

Das Indefinitpronomen all- - all- -

  • Im Singular bezieht sich aller, alle, alles auf die Gesamtheit unzählbarer Nomen.
    • Wahrscheinlich Plural = countable?
  • Alles steht sehr oft allein und hat eine ganz allgemeine Bedeutung.
    • Alles ist gut.

Day 680


Markdown subscript/superscript

Don’t forget that I can use sub/sup HTML tags in markdown!

Day 675

qutebrowser new profile and basedir

Created a new basedir, where I symlinked the from the original one: 11399 5.11.2020 09:54 ln -s ~/.config/qutebrowser/ ../profile2/config/

To run with it, python3 -B ../profile2 (-B is the same as --basedir)

My use case would be to run a separate instance with tabs on top instead of in the left, for jupyter and similar. I can’t set tab position per window in the same profile.

zshrc aliases for output and copy

As I seem to do that often:

xrealpath() {
    realpath "$1"
    realpath "$1" | xc

xpwd() {
    pwd | xc

Both outputs to screen and saves to buffer. xc is still this:

 alias xp='xclip -selection clipboard o'

pandas nullable integer data type

Nullable integer data type — pandas 1.1.4 documentation Usual int cannot contain NaN values, and things like df[0].astype(int) fail in that case.

To use nullable ints: df[0].astype('Int64'). (Note - it’s a string. int works both ways.)

pandas styling

Pandas can do styling! Had no idea: Styling — pandas 1.1.4 documentation

def _color_original(s):
    if s[5]==-1:
        return ['background-color: lightgrey']*len(s)
    elif s[5]>0.9:
        return ['background-color: #a5a1ff']*len(s)
    elif s[5]>0.8:
        return ['background-color: #bebaff']*len(s)
    elif s[5]>0.7:
        return ['background-color: #d8d6ff']*len(s)
        return ['background-color: white']*len(s), axis=1)

style.applymap() is elementwise, style.apply() is per row/column/table.

Day 674

Slack / Electron apps hard restart

<Ctrl-Shift-R> does a hard-restart that sometimes fixes issues with Electron apps such as Slack. (TS)

pandas invert operator

~ inverts boolean values.

Used like this: dd[~dd.companyName.str.contains("po")] -> “does not contain”

Online buchstabierung Deutsch

Buchstabieren am Telefon auf Deutsch nach DIN 5009 - Ziffern nach DIN 5009 - Satzzeichen und Sonderzeichen

Day 673

Java / German

Sehr schönes deutschsprächiges Buch über Java, dem ich nützen könnte, um mein IT-Wortschatz zu verbessern:

Rheinwerk Computing :: Java ist auch eine Insel - Inhaltsverzeichnis

Intellij Idea commit window

The commit window is (as with conflict resolution) a fully-functioning text editor, including all the usual ideavim bindings! All changes/diffs get automatically updated as they get changed.

Intellij idea copy file

“Copy”-ed files get pasted as the filename with all the extensions. “Copy filename” does only the file name, w/o the last extension.

Intellij environment variables copypaste - check for spaces at the end.

I’ve been bitten by this before at least twice. When copypasting them, for example even from another Intellij running configuration, check for spaces at the end. Not visible at all ever in any of the context one might hope to see them.

Java REPL / shell / cli

Called jshell on my box. Has tab-completion etc. Really nice!

jshell> NavigableSet original = new TreeSet();
   ...> original.add("1");
   ...> original.add("2");
   ...> original.add("3");
original ==> []
jshell> original.floor("2")
|  Warning:
|  unchecked call to floor(E) as a member of the raw type java.util.NavigableSet
|  original.floor("2")
|  ^-----------------^
$8 ==> "2"

Java floor/ceil with Pairs and in general, especially with HashMapS and stuff

Think about compareTo() and equals() of the classes if I’m doing something that may need it. Such as using Pairs as keys in a TreeSet and expecting that they will be compared only based on first value.

Java comparing Integers

Java: Integer equals vs. == - Stack Overflow

Using !=/== … works only for Integers -128..127. Otherwise they will likely be different Objects => not equal. And of course, -128..127 is exactly the kind of numbers one might see in tests as opposed to real world situations.

The way to do it is if (!one.equals(two)) {

OWASP Java Gotchas

TODO read this: Java gotchas - OWASP

(Link from AA in the context of comparing integers)

Linux - run command after some time has elapsed

I usually use sleep 5m && foobar, so if I change my mind and ^C the sleep, the next command doesn’t run. – Peter Cordes May 28 ‘16 at 14:07 1

And sleep is installed by default in a lot of places!

sleep 5m && foobar

From the man page:

SUFFIX may be ‘s’ for seconds (the default), ‘m’ for minutes, ‘h’ for hours or ‘d’ for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number.

Duckduckgo (ddg) Wolfram Alpha !bang

!wa now plus 12.5h

Day 672

diff side by side

bash - unix diff side-to-side results? - Stack Overflow

diff -y (NB not git diff) does really nice side by side viewing, and still colours output in the columns.

Learning Java

Found Think Java in my old notes and it’s really nice.

Day 668


Ctrl+C - “Steuerung-C” - Strg.

Random / interesting / patterns / ML / vision

Intersection over Union (IoU) for object detection - PyImageSearch TODO + add to Fiamma

vim verymagic

This again, but:

  • \v - very magic - everything has special meaning
  • \V - not magic - everything has literal meaning meaning, \ to activate special

Day 667

vim TODO

For my log, it would be interesting to create a keybinding that prepends current time to the beginning of the new created line and stays in insert mode.

Zoom shortcuts

Hot keys and keyboard shortcuts – Zoom Help Center

  • <Alt-A> - mute/unmute microphone.

German resources

Day 665

Confluence creating pages drafts

Confluence saves draft version of the things you write if a page already exists. If the page is not created yet, no draft version is saved.

Pycharm project settings

Project settings are not separate, but part of the general ‘Settings’.

Day 662

Google Sheets / formatting.

Conditional formatting, especially the one that does gradient, is really nice. Butif you enter numbers with “.” as decimal point, while the sheet has “,” as decimal “point”, it will silently fail and color everything white.

Day 661

German / Denglisch

  • Gemerget / Gemergt - no consensus :) 1
  • „mom“ heißt „Moment Mal“ oder „Einen Moment bitte“. 2
  • “Aufruf der Java Platform” = “call” in IT context
  • “gelinde gesagt” = “мягко скажем”; gelinde = mild, soft.

git/bitbucket/intellij pull requests and resolving conflicts


TODO grep regex

Lookarounds look useful: Regex Tutorial - Lookahead and Lookbehind Zero-Length Assertions

If TC triggers Sonar, it will provide a link to it once it finishes in the build log! (Same for CheckStyle - if it breaks because of it, going to the error and scrolling up in the log will lead to the problematic file and line.)

tig (git)

TS showed it to me some days ago, installed it, does really nice and colorful visualizations of branches statuses etc etc etc. Keyboard-driven and configurable and basically everything I might want, including easy to remember name.

pandas / pyplot bar plots

This is awesome: Bar Plots in Python using Pandas DataFrames | Shane Lynn

Day 660

Corona Ukraine

Система моніторингу поширення епідемії коронавірусу

Zoom annotations

TL;DR use only one screen and they work.

I have a potential fix for this! I have 2 screens (internal laptop monitor, and external monitor). I noticed that the problem only presents when I’m using “dual monitor” mode and have “gallery view” enabled. The controls also don’t appear if I have “full screen” enabled. They also won’t appear if I have either window on the external monitor.

It works in “dual monitor” mode if I have the controls window set to “speaker view” and not in “full screen” with both windows on the internal (laptop) monitor. I can then move either window to the external monitor. If I’ve accidentally started Annotation mode “wrong”, I have to cancel it and move all windows to the internal monitor before re-starting Annontation mode.

I have my controls back! This is with version 5.2.458699.0906 1

I have version 5.3.47…. (no way to copypaste) and they don’t, but using only one monitor helped. Though I get a black screen underneath annotations when/as I’m writing them.

Day 659

zsh alias pwd | xc

alias pwx='pwd | xc'

I really need to gather them all in one place and make ~/.zshrc cleaner and neater.

bash / python / whatever todo small things

~I keep doing things like echo 1 2 4 | paste -sd+ | bc -> cc 123/5 etc. Some small things like avgof 1 2 3 etc would help. Has this been solved by something, any sci / mathematical environment? If not I’d write it the functions myself.~

cc() python3 -c "from math import *; from statistics import *; print($*);"
alias cc='noglob cc'

Added statistics to it, now I can do things like cc mean([2, 4, 9]). (As a bonus stdev() etc., full list). Works for now. ", if any, have to be escaped.

zsh prompt

Yet another change (theme file clean2.zsh-theme): PROMPT='%{$fg[green]%}(%*/%!) %{$fg[$NCOLOR]%}%B%b%{$reset_color%}%{$fg[blue]%}%B%5c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '

It transforms to:

(10:23:09/10712) some/folder/whatever/ $ mycommand

Removed the user (that I had to edit out often), moved current time from PROMPT to the left side (now I can happily copypaste CLI args and output again).

regex greedy / lazy

Regex Quantifier Tutorial: Greedy, Lazy, Possessive TODO

TL;DR most regex engines are greedy by default. Greedy = ‘longest possible match’. Making it lazy sometimes means adding a “?” to the quantifier, such as .*?. Not supported everywhere, notably grep does this only with the perl syntax (grep -P .*?).

For vim: regular expression - How to make regex matchers non-greedy? - Vi and Vim Stack Exchange

info command instead of man

Nice, had no idea this existed. info diff, for example. Found here: linux - Understanding of diff output - Unix & Linux Stack Exchange.

Unified diff how to read

@@ -1,4 +1,5 @@:

  • The number after the comma is the length of the chunk (in the old or new file), and
  • the number before the comma is the line number for the beginning of the chunk.
  • The + and - signs refer to adding and deleting lines, respectively. 1

Gnu diff man page has more: Detailed Unified (Comparing and Merging Files)

Git / Jira / Bitbucket branches and connections to tickets

As long as the branch name contains the issue key (ABCD-123), it gets connected - but only if the branch is created after the creation of the ticket. 2

As stated previously in this question, it is not possible. You are screwed if you create the branch first.

But also it seems that mentioning an issue name in the pull request (does this work for commits?) also works:

Simply renaming the Pull Request in Github to include the issue id XXX-nnn in the name triggered that PR and Branch to be linked to the Jira ticket. 2

Random / i3 / workspaces

I could define a workspace officially, like number 5, for terminals I don’t really need but that are open in deep folders I might need later.

Random / documentation / dtb

Sometimes I miss the ability to drag and drop screenshots to my textfile with descriptions of stuff I did. I can drag and drop screenshots but they are a bit ephemeral. An interesting idea would be create a different keybinding that creates screenshots that get put in a particular folder; I can still drag-and-drop them, but I’ll have stricter guarantees that they’ll be there when I’ll look for them.

vim plugin MultipleSearch

MultipleSearch - Highlight multiple searches at the same time, each with a different color. : vim online

:Search sth
:Search somethingelse

Highlights them in diff colors, just what I need. n/N works only on the last one.

vim-scripts/MultipleSearch2.vim: Improve Multiple search looks like an improved version of the above.

vim search and substitute

You can use \1 etc for %s/.. commands, if the groups where previously defined by you in a usual /search-for-stuff!

/\v(https?):\/\/(.{-})\/.*        <-- Search
:%s,,Protocol:\1 - Domain:\2,g    <-- Substitution

This is awesome.

Day 658


Tickets are linked automatically when mentioned like WHAT-1234, but only with spaces around them; WHAT-1234: result, for example, wouldn’t work.

zsh alias for summing up a column of numbers

alias sumup='paste -sd+ | bc'

bash sort version numbers

This is nice! sort -V sorts by “version numbers” => 1, 10, 20, 50, 200, instead of the alphabetic 1 10 20 200 50.

bash zsh history / aliases TODO

I need something like “output to CLI and copy to clipboard” + I need a smaller timestamp and to the left, not right-aligned, so I can more easily copypaste stuff.

Day 656

Quotes / HN

I think part of the problem is people being raised to believe that love, in the biochemical sense, is the most important part of a relationship. Hence when they start feeling similar feelings for others, their relationship can weaken. But a relationship can be about so much more than just the biochemical side: two people, with similar goals and values, working together to build a better life for themselves and their children, and to help each-other achieve their dreams. 1

Random / Interesting

Zersetzung - Wikipedia “(German for “decomposition”) is a psychological warfare technique used by the Ministry for State Security (Stasi) to repress political opponents in East Germany during the 1970s and 1980s.”

Home wifi/ethernet speed comparison

TL;DR Download speed with ethernet is 4x faster, no differences otherwise.

Sa 17 Okt 2020 17:15:44 CEST.

Wifi, 50cm from router:

$ speedtest-cli

Retrieving configuration...
Testing from [redacted]
Retrieving server list...
Selecting best server based on ping...
Hosted by [redacted]: 46.246 ms
Testing download speed................................................................................
Download: 101.10 Mbit/s
Testing upload speed......................................................................................................
Upload: 3.64 Mbit/s

Ethernet from same router:

$ speedtest-cli

Retrieving configuration...
Testing from [redacted]
Retrieving server list...
Selecting best server based on ping...
Hosted by [redacted]: 40.086 ms
Testing download speed................................................................................
Download: 395.90 Mbit/s
Testing upload speed......................................................................................................
Upload: 3.89 Mbit/s

Day 654

Added zsh alias for copying current dir

alias ccd='pwd | xc'; though I kinda feel the task would be solved nicely as keyboard shortcut for kitty. + Reminder to myself that zsh nicely cd-s to it when pasting the folder, without cd.

Also find | grep is now f instead of ff.


“Du spricht für uns alle”

English / interesting

grep for looking for tests in different files

Forgetting about this nice use of grep:

grep "whatever" * gives the matches while also displaying the filename!

Day 653

Intellij Idea Ideavim actionlist

And yet another place to find this! :actionlist as command in ideavim.

Ideavim jump to place of last edit

IdeaVIM Help: motion is the last readable docu I can find, from 2006.

gi starts insert mode at the last place insert mode was exited; '^ just moves the cursor there.

Intellij Idea tests not running

Had an issue with “Class not found” when running tests, fixed with “Invalidate caches and restart”

Intellij up/down keys

My custom up/down keys set via xmodmap (<Super-C> etc.) got recognized everywhere in the OS except intellij; Can get configured in intellij keymap.

Day 652

Intellij idea toolbars

“View -> Appearance -> Tool window bars” gives extremely useful tool window bars that include a number, the one I can use in <Alt-N> bindings to make them appear! Same goes for the …tabs to the right with Structure etc.

Intellij building complex stuff and running maven goals

Once N maven goals or whatever are run and N tabs opened, they can be found again in the “Run” tool window bar (<Alt-4>). Particular tabs can be also successfully restarted.

maven skip checkstyle

mvn [target] -Dcheckstyle.skip does the magic without editing any POMs etc. 1

Java Comparators

  • Not bound to -1, 0, +1, any positive/negative number works.

Random / interesting

Nightcore - Wikipedia - A nightcore edit is a cover track that speeds up the pitch and time of its source material by 10–30%.

Day 651


in trockenen Tüchern - “cut and dried” = “final”. See in trockenen Tüchern - Wiktionary

Java profiling with visualVM

Day 648

scp can do autocompletion!

Nothing to add, but I think it works if you have access via public key instead of passwords. scp what-ever:/home/whatever/..<TAB> works nicely with zsh even visualizing it like usual.

Also TODO rsync apparently can do the same things as scp, but better, I should give it a chance.

Pandas / matplotlib

It’s possible use panda’s graphs as an ax and do all other modifications to it!

ax = data.plot(y=['tp','fn'], kind='bar',stacked='true')

jupyter / mpl / google docs

You can drag and drop graphs directly from jupyter into a google docs presentation

Day 647

grep / uniq magic

uniq can compare stuff before / after N characters in the string, group together duplicate ones, etc!

  • uniq -w N looks at only the N first characters.
  • uniq -s N don’tt look at the first N characters
  • uniq --all-repeated[=METHOD] prints all duplicated lines and optionally separates them via METHOD. separate is really nice as method.
  • uniq -c prefixes line by number of occurrences of that line

And I guess again - uniq works only on sorted data.

Day 646

Slack formatting

Format your messages | Slack:

  • ~strikethrough~, *bold*, _italic_.
  • > quoting is as usual.
  • Highlight text and paste a link -> create a link.





vim folding by tab works again now!

Had to remove this snipped from vimrc:

augroup remember_folds
  autocmd BufWinLeave *.* mkview
  autocmd BufWinEnter *.* loadview
augroup END

vim folding

Will now try to use almost exclusively folding by tabs. For this, these are going to be helpful: 1

zo		Open one fold under the cursor.  
zc		Close one fold under the cursor.  

zO		Open all folds under the cursor recursively.  
zC		Close all folds under the cursor recursively.  

za		When on a closed fold: open it.  
		When on an open fold: close it 
zA		When on a closed fold: open it recursively.
		When on an open fold: close it recursively 

zv		View cursor line: Open just enough folds to make the line in
		which the cursor is located not folded.

zX		Undo manually opened and closed folds: re-apply 'foldlevel'.
		Also forces recomputing folds, like |zx|.

zm		Fold more: Subtract one from 'foldlevel'.  
zM		Close all folds: set 'foldlevel' to 0.

zr		Reduce folding: Add one to 'foldlevel'.
zR		Open all folds.  This sets 'foldlevel' to highest fold level.

zn		Fold none: reset 'foldenable'.  All folds will be open.
zN		Fold normal: set 'foldenable'.  All folds will be as they
		were before.
zi		Invert 'foldenable'.


[z		Move to the start of the current open fold.  
]z		Move to the end of the current open fold.  
zj		Move downwards to the start of the next fold. 
zk		Move upwards to the end of the previous fold.  

TODO and XXX conventions

coding style - Where does the TODO convention come from? - Stack Overflow - XXX as marker for something dangerous. Fixme Comment in c2 wiki for more.

TODO vim highlighting

Very ugly but it works:

fun! SetTodo()
    syn match modo /.*MODO.*$/
    hi link modo Keyword
    syn match nodo /.*NODO.*$/
    hi link nodo javaScript
    syn match todo /\s*TODO.*$/
    hi link todo vbTodo
    syn match done /\s*DONE.*$/
    hi link done cssListProp
    syn match xxx /\s*XXX.*$/
    hi link xxx htmlError
autocmd filetype markdown :call SetTodo()

Day 645

How to prettyfy json using jq

jq . inputfile.json gives a nice pretty colored indented output.

Wolfram alpha “time between”

Works also in this shorter format: (time between $date1 $date2)

Day 641

screen attaching non-existing named screens creates them

If I do screen -R 20, and there’s no screen named ‘20’, such a screen will be created and attached. Neat.

killing all screens

Quitting all screens from inside screens is the screen command C-a \ 1

Day 640

i3 shortcuts for monitors

Remembered about and updated the shortcuts for focusing the different monitors:

# focus outputs screen
bindsym $ms+a focus output eDP-1
bindsym $ms+o focus output HDMI-2
bindsym $ms+e focus output DP-1-1

Connected to me remembering about the tabbed layout:

# change container layout (stacked, tabbed, toggle split)
bindsym $ms+s layout stacking
bindsym $ms+Shift+t layout tabbed
bindsym $ms+Shift+s layout toggle split

takes less space than my usual stacked, but makes it hard to focus a different screen via left/right - until now.

bash rm multiple folders

For removing multiple folders if it has to be done often, and the folders may or may not be there, esp. with wildcards, current best option I found is not to do rm -rf one/* two/*something* three but rm -rf one/* && rm -rf two/*something* && rm -rf three. If one breaks the other ones will still run.

zsh removing an alias + zsh feature of ‘you sure you want to delete all N files from… ‘ + rm -r **

  • unalias rm 1
  • The feature can be removed by an option, but this is nice:

    I don’t know why but the following works for me - no questions asked [..]

    rm -rf **

Works for me too.

Random / phrases

That answers a question, but not this one! :) – Lambart Jul 28 ‘17 at 0:43 2

Intellij Ideavim full list of keybindings + configured movements.

ideavim/ at master · JetBrains/ideavim

 * |CTRL-B|               {@link com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageUpAction}
 * |CTRL-D|               {@link com.maddyhome.idea.vim.action.motion.scroll.MotionScrollHalfPageDownAction}
 * |CTRL-F|               {@link com.maddyhome.idea.vim.action.motion.scroll.MotionScrollPageDownAction}
 * |<BS>|                 {@link com.maddyhome.idea.vim.action.motion.leftright.MotionLeftWrapAction}
 * |CTRL-H|               {@link com.maddyhome.idea.vim.action.motion.leftright.MotionLeftWrapAction}

Half-page-down (<Ctrl-D>) doesn’t work in the output of running programs / debuggers, but <Ctrl-F> always does. (And <Page Down> too, ofc.)

ls -l, last modified and files from last year

me@server:/some/folder$ ls -larh ..
total 290M
drwxr-xr-x  3 me users 4.0K Jul  7 16:51 file
drwxr-xr-x  4 me users  12K Jul  7 16:51 file
drwxr-xr-x  4 me users 4.0K Jul  7 16:42 file
drwxr-xr-x  2 me users 4.0K Jul  7 16:32 file
drwxr-xr-x  4 me users 4.0K Jul  7 16:32 file
-rw-r--r--  1 me users    0 Jul  7 16:19 file
-rw-r--r--  1 me users 4.0K Jul  7 16:19 file
-rw-r--r--  1 me users    0 Jul  7 16:31 file
-rw-r--r--  1 me users 1.6K Jul  7 16:32 file
-rw-r--r--  1 me users 144M Oct  1 13:23 file
drwxr-xr-x  7 me users 4.0K Oct  1 13:35 file
-rwxr-xr-x  1 me users 4.9K Oct  2  2019 file
-rw-r--r--  1 me users  46K Oct  4  2019 file
-rw-r--r--  1 me users  45K Oct  2  2019 file
-rw-r--r--  1 me users 146M Oct  2  2019 file
drwxr-xr-x  2 me users 4.0K Oct  2  2019 file
-rwxr-xr-x  1 me users 3.8K Jul  7 16:32 file
drwxrwx--- 13     500 users 4.0K Mar 27  2020 ..
drwxr-xr-x  9 me users 4.0K Sep 30 17:10 .

If files are not from this year, it shows the year instead of the time!

hashing / checksum utility jacksum

Jacksum - a free cross platform checksum utility Is also in the repos as jacksum.

jacksum -a hashingAlgo -x filename

Slack zooming / font size

<Ctrl-plus> and <Ctrl-minus> increase / decrease Slack font size!

Day 639

head / tail starting from an offset

bash - Linux head/tail with offset - Stack Overflow:

 -n, --lines=K
        output the last K lines, instead of the last 10; 
        or use -n +K to output lines starting with the Kth

You can therefore use ... | tail -n +2 | head -n 3 to get 3 lines starting from line 2.

Simple but effective. tail -n +N does tail starting from linenumber N.

Intellij idea search / find

Search is search, but “find in path” (and some other stuff) is find. I wonder if there’s a meaningful semantic difference in there. Semantic difference between Find and Search? - Stack Overflow has the logical ones, but I can’t connect it to how intellij idea uses them.

Day 638

i3 disable changing workspace via mouse wheel

bar {
    wheel_up_cmd nop
    wheel_down_cmd exec ~/.i3/scripts/custom_wheel_down

1 is an example. Disabled it in config, not the i3 statusbars own configs.

Intellij idea debugging step out

“Step out” (<Shift-F8>) skips to the first line executed after returning from the current method.

Intellij idea debugging / run code fragment

<Shift-Return> changes the window from one line to multi and back.

tee vs less with UTF-16 / UTF-16LE encoding + reading them in vim

If a file is UTF-16 encoded, tee works much better than less.

To read UTF-16LE in vim, the command is: :e ++enc=utf-16le

Todo diensttagebuch

In my text version of this, I need a nice way of interlinking parts of the text. Ideally in a way that adding text doesn’t break it, and in a way that it’s still text-safe.

Day 635


screenkey1 (in the repos too) shows the keys you pressed on the screen. screenkey --show-settings shows a nice GUI before start with all the configs.

Looks like the second answer here: folding - Is there a best practice to fold a vimrc file - Vi and Vim Stack Exchange

Vim foldmodes

This answer has an awesome idea for folds, something very close to what I was looking for in my long notes file: folding - Is there a best practice to fold a vimrc file - Vi and Vim Stack Exchange

In general TODO vim folds - create a nice stable system instead of the ad hoc hell I have now.

Also How to enable and use code folding in Vim? - Unix & Linux Stack Exchange has a nice summary of fold keybindings:

vim keybindings

I forgot I used <leader> for most of the things I’m currently using F12 for!

Work-home keybindings

TODO I guess A shell script that changes monitor configurations, volume, changes some of the zsh aliases to show me the correct taskwarrior todos, etc.

Something like this:

if [ "$1" == "work" ]
    echo "Setting configs to work..."
    export SOMETHNIG="something" ...
    echo "Setting configs to home..."
    export SOMETHNIG="something" ...

How do I get all open terminals to use the new env. variables though?

Day 634

Markdown syntaxt highlight in vim and URIs

If you paste an URL containing characters with a meaning in markdown, it breaks syntax highlight till the end of the file. Especially URIs containing an uneven number of underscores. Fix is either make it code, or indent it - it seems formatting is local for indentation, at least for vim.

Parsing json via jq

It supports newlines in filters!

To read

“Data science and the command line” (from json - How to nicely remove empty array in jq - Stack Overflow}

vim / terminal drag and drop

I can drag and drop my screenshots in the terminal and it pastes the absolute location!

uniq works only on sorted output!

Wow. …wow. command line - Uniq won’t remove duplicate - Unix & Linux Stack Exchange

This explains really a lot.

Day 633

Java logical operators shorct-circuiting

The && and || operators “short-circuit”, meaning they don’t evaluate the right-hand side if it isn’t necessary. The & and | operators, when used as logical operators, always evaluate both sides.

There is only one case of short-circuiting for each operator, and they are:

  • false && ... - it is not necessary to know what the right-hand side is because the result can only be false regardless of the value there
  • true || ... - it is not necessary to know what the right-hand side is because the result can only be true regardless of the value there. 1

Quoting quotes and answers with code from Stack Overflow

Clicking on “improve this answer”, even when not logged in, gives access to the source markdown that I can copy here preserving most formatting.

Stand-off markup (NLP)

Stand-off markup (also known as remote markup or stand-off annotation) is the kind of markup that resides in a location different from the location of the data being described by it. It is thus the opposite of inline markup, where data and annotations are intermingled within a single location. 2

The wiki it’s from is also nice: TEIWiki It’s All pages - TEIWiki would be interesting to look through, NB it has a non-intuitive “next page” link there.

taskwarrior TODO

I need either a command or an alias for “create task and start immediately”, along with some nice way to create boilerplate code for tasks

Intellij idea debugging “Drop Frames”

“In case if you want to “go back in time” while debugging you can do it via Drop Frame action. This is a great help if you mistakenly stepped too far. This will not revert the global state of your application but at least will get you back by stack of frames.” 3 (Icon with a red X on top left.)

Java declaring variables inside or outside a loop

Does it make a difference if I declare variables inside or outside a loop in Java? - Software Engineering Stack Exchange - TL;DR it doesn’t, if you are not creating complex objects. The way to learn this is to look at the generated bytecode, using javap.

Day 632

vi mode / readline / inputrc / history

This is freaking awesome:

k: history-search-backward
j: history-search-forward

… in ~/.inputrc allows using j/k for scrolling through history in vim mode. 1 This configures readline that then is used by (at least) bash, zsh, and fish.

ag command

I still have it installed as a standalone command, I should use it. Ag (silver searcher) is better than ack, which is better than grep. ggreer/the_silver_searcher: A code-searching tool similar to ack, but faster.

TODO get proficient with them and learn how exactly they are better for writing code.

German | muskelkrampf | English Dictionary - muscle cramp

Intellij Idea “Find in path”

<Ctrl-Shift-f> for “Find in path” - extremely useful for large codebases; info from Tony.

Day 631

Random / Interesting / Quotes

“The best minds of my generation are thinking about how to make people click ads.” –Jeff Hammerbacher

Found on I no longer build software | Hacker News in the context of Allow docker push’ to push multiple/a subset of tags · Issue #267 · docker/cli · GitHub:

@solvaholic: Sorry I missed your comment of many months ago. I no longer build software; I now make furniture out of wood. The hours are long, the pay sucks, and there’s always the opportunity to remove my finger with a table saw, but nobody asks me if I can add an RSS feed to a DBMS, so there’s that :-)

Slack ‘set status’

In ‘set status’ there’s a ‘clear’ option, it controls when the status gets reset, minutes/days.

Emacs tutorials

Uncle Dave - YouTube (No script is too simple | Hacker News) - for later. Notable there is:

Day 627

Intellij idea debugging “run to cursor”

  • “Run to cursor” is <Alt-Shift-9> and the ideavim cursor works!
  • “Show exectution point” <Alt-F10> is also really useful


Remembered that redshift exists, added it to startup. It’s the program that makes screen redder at night, a la twilight / night mode / etc etc etc.

Day 626

Intellij reopening closed windows such as debugging

Reopening closing windows can be done through View -> Tool windows. It has nice shortcuts that are <Alt-N>, with N=0..9. For example, debug window is <Alt-5>.

Additionally - I should use F7 / ‘step into’ much more.

Intellij idea structure

<Alt-7> opens a nice structure window with info about the long class you’re editing. With nice options like show public/fields/..

Gson / json serialization of objects

java - Save state of object in IntelliJ debug? - Stack Overflow - google/gson is the answer. User guide: gson/ at master · google/gson · GitHub

Gson gson = new Gson();
gson.toJson(1);            // ==> 1
gson.toJson("abcd");       // ==> "abcd"
gson.toJson(new Long(10)); // ==> 10
int[] values = { 1 };
gson.toJson(values);       // ==> [1]

// Deserialization
int one = gson.fromJson("1", int.class);
Integer one = gson.fromJson("1", Integer.class);
Long one = gson.fromJson("1", Long.class);
Boolean false = gson.fromJson("false", Boolean.class);
String str = gson.fromJson("\"abc\"", String.class);
String[] anotherStr = gson.fromJson("[\"abc\"]", String[].class);

Not drag-and-drop for more complex stuff though.

Intellj Idea Exceptions Breakpoints

You can create breakpoints at all exceptions of a certain type, even when they are caught. May lead to discovery that there are a lot of them in the code :)

On this topic - “Run to cursor” is nice

Day 625

English / Interesting

Tohu wa-bohu - Wikipedia “is a Biblical Hebrew phrase found in the Genesis creation narrative (Genesis 1:2) that describes the condition of the earth (eretz) immediately before the creation of light in Genesis 1:3.”

Now let’s play with Jekyll and UTF-8.

וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֙הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם‎

— Genesis 1:2, Westminster Leningrad Codex

Now the earth was formless and empty, darkness was over the surface of the deep, and the spirit of God was hovering over the waters.

— Genesis 1:2, New International Version

Better master file

So, before we had this file:

echo "Concatting all existing days"
cd _posts
echo \
layout: page
title: Master file
permalink: /master/
> ../

cat * | grep -v "layout: post" | grep -v "categories: \[" | grep -v "title:  \"Day" | grep -v "date:   20" | grep -v "\-\-\-"  >> ../

This didn’t really work well for various reasons, now I did this right:

layout: default

<div class="home">
  {%- if page.title -%}
    <h1 class="page-heading">{{ page.title }}</h1>
  {%- endif -%}

  {{ content }}

      <ul class="post-list">
      {% for post in site.posts %}
      <h1><a href="{{site.url}}{{site.baseurl}}{{ post.url }}">{{ post.title }}</a></h1>
        <p class="author">
          {% assign date_format = site.minima.date_format | default: "%b %-d, %Y" %}
          <span class="post-meta">{{ | date: date_format }}</span>
        <div class="content">
          {{ post.content }}
      {% endfor %}

Master file is at the same URI: Master file | Diensttagebuch

Jekyll raw

The nice tags for raw input, of course, work immediately, no spaces between (%raw%)And the start of the actual content(%endraw%).

Day 624

English / German dictionary :: Die Kacke ist am Dampfen :: German-English translation == shit hitting the fan

Intellij idea running configurations

One can export it to ~/.idea/runConifgurations/*.xml which can be edited with any editor or copied to another project folder.

Intellij idea enable VCS integration

Had this issue when creating a project in a folder that was not equal to the folder with the project files downloaded from git. It did not automatically recognize .git, but I could do it from the VCS menu, something like “choose VCS type”->git etc. Disappeared after I did it.

From Error on openjdk11, cannot find javadoc · Issue #26 · chenjianjx/wsdl2html · GitHub: export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")

readlink resolves symlinks. Alone it just gives you the file the symlink points to. readlink -f follows each and every symlink to the very end. On my box, the difference is:

me:~/ $ readlink /usr/bin/javac     
me:~/ $ readlink -f /usr/bin/javac  

BUT! The actual JAVA_HOME thing should be solved as a setting in Intellij->Maven, as noted in Day 554 | Diensttagebuch.

Day 623


TODO Ankify: spelling of Colleague


schnipsel | Übersetzung Englisch-Deutsch - scrap/shred/snipped (noun). Mentioned by Caro in context of Schnitzeljagd – Wikipedia that is an interesting thing by itself.

git coloring

git --color=never means that no color gets added by git, but any existing is preserved. Usually the program piping the output has to be told that colours are still needed despite the fact that it’s not outputting to a terminal.

bash pretty CSV viewer

Pretty CSV viewing on the Command Line - Stefaan Lippens inserts content here this is realy nice! In goes a CSV, out goes a pretty CSV. With all the tabs right etc. Piping output from daff diff to this works wonders.

Added his function to .zshrc:

function pretty_csv {
    column -t -s, -n "$@" | less -F -S -X -K

Day 619

vim antipatterns w vs e + vim movements

I should use e much more than w, as that’s what I really usually need. And in general I should take the time to get to know better the tools I’m constantly using. I guess ‘right’ vim is something like ‘right’ typing.

Also, never used them like this, but c of course takes all movements, so changing next two lines or changing from cursor to beginning of the line also works.

Jira collapsible / spoiler block + code syntax highlighting

This 1 is how you do collapsible spoilers in Jira:

{code:bash|title=Header for code|collapse=true}
echo this is some code

Shows also how to define which syntax highlighting to use.

kitty paste to terminal and copy url hints

Added this to config: map kitty_mod+p>c kitten hints --type path --program @ - copies hinted URL to clipboard.

Default map kitty_mod+p>f kitten hints --type path --program - - pastes the hint to the current terminal window.

This gets rid of so much copypasting oh my God.

Libreoffice calc freeze rows and columns

The setting for freezing headers and stuff so that they remain visible wherever you scroll is in View -> Freeze cells

bash sort by multiple columns

sort -k 13 -k 15 -k 7 -t ";" -d filename - here the multiple -ks are the different sorting keys. -t is separator, and -d is dictionary order. Interestingly, it automatically sorts by everything else too after the column you give it - if you want it to look only at that one column, you do -k 2,2 2

Day 618

Random / Interesting

vim regex separator

I have been using \s as “word separator”, this is wrong. \s in vim is just a whitespace character - so tabs, spaces etc. For what I usually want, \A is any non-alphabetic-character. (\a being an alphabetic one).

vim regex inverse match capturing group + ‘very magic’ mode

/\vcat (dog)@!
/cat \(dog\)\@!

First one is very magic, second is the same without it. @! is a negative match to the preceding capturing group (could have been (\1) too).

\v activates “very magic” mode where everything except letters and underscore has special meaning. This is actually going to be very handy. 1

I’ve actually been using regexes quite a lot lately, have no idea how I lived without them when parsing very big log and text files.

vim paste last searched regex

:s/<Ctrl-R>/ inserts the last searched for regex between the slashes. This is wonderful and no more copypasting stuff! 1

Intellij idea checkstyle tests

In settings, you can configure checkstyle to run everywhere [not] including tests. If you don’t include tests, you won’t get to ‘run checkstyle on the current file’.

i3 vertical tabbed windows

If I have windows that are tabs stacked vertically to make it not-a-tab-anymore I just have to move it one level above or below tabs. If it’s stack 3/3, amking it 4/3 would make it the bottom part of a split whose top part is vertical tabs.

zsh evil registers

Intellij idea read-only decompiled class sources

.. predictably, “Download sources” makes them downloaded, readable and debuggable.

Also nice is the “Alternative source available for” - todo understand how exactly do poms, sources, etc etc etc. play with all this. I assume if maven module wants X, and X can be found in maven and in the list of dependencies in Intellij, I get this choice?

Day 617

zsh prompt changes

To continue the idea to make it easier to record my steps, did some changes to the clean oh-my-zsh theme. For this, I made a copy of the theme file /home/%username%/.oh-my-zsh/themes/clean2.zsh-theme, and using zsh: 13 Prompt Expansion added the following:

  • history event number at the end of the prompt, after the time (RPROMPT='%*/%!')
  • Added the last N elements in the path while leaving tilde contraction. (PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%5c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) ', the number 5 represents the number of directories to show.)

Now the prompt looks like this:

%username%:~/o/dtb/assets/pics/ (master✗) $                                                             16:14:10/10548

timewarrior :quarter

Timewarrior has many interesting hints, I always missed something with now and previous month - of course :quarter exists.

Day 616

Disabling wifi to use ethernet

This should have been done long ago but discovered this now. If I have both a wiki and ethernet and want to stop connecting to the wifi, disconnecting from the endpoint is much less reliable than disabling wifi alltogether.

fc and history

fc also accepts the history number of the command to edit and run. So fc 1238, for example.

Ideavim map for <Esc>

Quite often, especially in the commit window, I want to use Ideavim’s normal/command mode, but <Esc> gets intercepted by Idea and closes the commit window. My old mapping works though:

imap jj <Esc>

in .ideavimrc.


zsh share registers with OS when copypasting

Now I can yank stuff from the zsh command line and paste them in other applications etc.

Day 613

Finally fixed the date / time / tztime saga

Looked into the TZ environment variable, it’s the overwritten “Berlin” one. I forgot I had this beauty in .zshrc: export TZ="/usr/share/zoneinfo/Europe/Berlin"

Probably a relict of an old hacky way to set time when I couldn’t do it properly.

Interestingly, even i3status listened to it (how? why? At which point does it access zsh environment variables? Are environment variables zsh-specific and accessible to things started by/within zsh? How does this work? TODO). And interestingly, restarting zsh didn’t get date to output the right date, even with the right timezone set, I had to close and reopen the terminal.

Removed that line, restarted i3, now all times are set right and I can remove timezone info from my timestamps.

Vim insert time and date - updated mappings

imap <leader>d <esc>:put =strftime('%c')<cr>kJA
imap <leader>t <esc>:put =strftime('%H:%M:%S')<cr>kJA

They look like this:

Fr 04 Sep 2020 09:54:59 CEST

Qutebrowser / vim copypaste

If I’m copypasting something from vim with yW it copies the space after the last word. If I then paste it into the search of qutebrowser it won’t find anything if the string in the page doesn’t have a space after it.

git diff CSVs at field level

git diff --color-words="[^[:space:],]+" 1

daff tool for diff-ing CSVs

Daff is a “library for comparing tables, producing a summary of differences”. GitHub - paulfitz/daff: align and compare tables

It actually does a really nice visualization with colours, like that script I wrote a long time ago. Leaves field numbers too. In general it’s awesome.

More options available with the full form: daff diff --id field --padding sparse file1 file2 Has a lot of output formats!

Even ordered/unordered works, if you don’t set the wrong id column.

Vim folds empty line

To make the markers marking folds easier to edit, one can select an empty line at the end of zf, they will end up on a line by themselves, and you can happily paste stuff inside the fold.

Day 612

New shiny zsh alias

ff is now find | grep

i3 run and show windows

# bindsym $ms+d exec --no-startup-id i3-dmenu-desktop
bindsym $ms+d exec rofi -show run

# select windown
bindsym $ms+g exec rofi -show window

in i3/config. Rofi is nice and I forgot about it. Added a list of windows on $ms+g so that it’s similar to my qutebrowser keybinding.

Dependencies scopes in Intellij Idea

The default, “Compile”, is the “strongest”. Module dependencies - Help | IntelliJ IDEA contains a really nice table summarizing compile/test/runtime/provided.

Running a single test in maven

mvn -Dtest=UsersServiceImplTest test for all tests in that class, but you can also do wildcards and single test (yourclass#yourtest test) 1

Intellij idea module dependencies order

Order is important and whichever is the first will be used.

You can change the order in the GUI, but you can move them one step above and you can’t move multiple dependencies at the same time. Of course if you add a new one it goes to the veeeery end.

You can edit the configuration manually, inside the project it’s the .iml file that can be edited via whatever.

Get column in bash with cut

This is a thing that keeps coming up, TODO anki

awk - bash: shortest way to get n-th column of output - Stack Overflow

cut -f2 accesses the second field. -d is for delimiters, if not equal to tab. seems to be an OK service for sharing stuff, S. used it for wedding pictures and A. used it for uploading an .iso, both worked well.

Day 611

Libreoffice Calc opening files with default import settings

For multiple files with known settings, such as separator, decimal etc., libreoffice --calc mydata.csv --infilter=”CSV:44,34,0,1,4/2/1”

  1. Separator, 44 is the ASCII value of comma
  2. Text delimiter, 34 is the ASCII value of double quote
  3. Character set to use, 0 is the system default
  4. Line number to start conversion. I have no header line, so it is 1
  5. Cell format per column, separated by /. It does not seem to matter if there are a different number of columns in the data: Extra columns default to Standard, extra formats are ignored. 4 = date d/m/y; 2 = text; 1 = standard 1

Full documentation for infilter is here: Filter Options - Apache OpenOffice Wiki

Jekyll mixing html and markdown

I have to remember that putting markdown stuff inside HTML tags won’t work, like with the Actionlist yesterday.

git diff to stdin

Is it possible to git-diff a file against standard input? - Stack Overflow:

echo foo | git diff --no-index -- my_file -

Since git 1.5.1 there’s been an option to diff against stdin - it’s just not been documented

Germany “c/o” with letters and post

Day 610

x-www-browser and qutebrowser

If qutebrowser is not running and I click a link, another instance will be started, and it looks like this: myusername+ 19648 10.8 2.7 6125248 896828 ? Sl 12:10 10:07 /usr/bin/python3 /usr/bin/x-www-browser https://the-link-i-click.ed; I can’t find it easily as the process doesn’t contain the string qutebrowser.

English / German Redewendungen

English / British | analog | English Dictionary “analog” is English spelling, British is “analogue”

NLP / NER / Named entity recognition / ML

CH’s favourite example of ambiguity in NER:

[Paris(LOC) Hilton(ORG)](PER)

zsh theme

Changed it to clean, now I get the time when I ran commands. I so missed this, not sure when it all went wrong.

zsh history with datetime

history -E shows time and date when a command was run.

I really think I need something like a lab notebook approach to all my work experiments, this is a good step for this. So many terminals around with so much stuff run with different parameters and no way to track it.

history -E:

 7932  1.9.2020 18:11  history
 7933  1.9.2020 18:11  vim ~/.zshrc
 7934  1.9.2020 18:11  zsh
 7935  1.9.2020 18:11  ls
 7936  1.9.2020 18:13  pwd
 7937  1.9.2020 18:13  ls
 7938  1.9.2020 18:13  cd newkotlin-newusecase
 7939  1.9.2020 18:13  pwd | xc
 7940  1.9.2020 18:13  ls
 7941  1.9.2020 18:13  history -E
 7942  1.9.2020 18:15  vim ~/.zshrc
 7943  1.9.2020 18:15  zsh

Outputs only the latest items though. But it accepts a start parameter, so history -E 0 gives me what I need.

Also I didn’t fix the time last time apparently, date still disagrees with tztime, whatever I did last time was a temporary fix. Will be printing timezone info starting from now on.

Now I have a couple more default aliases:

alias h='history -E 1 | grep'
alias hh='history -E 1'
alias g='grep'

zsh alias for date in filenames/commands

alias sht='date +"%m%d-%H%M%S%z"'

Now I can do whatevercommand -o outputfile-$(sht) and it will paste a datetime like outputfile-0901-182113+0300 automatically.

curl quiet mode

The magic for waiting for files will be now

watch curl -I -s http://somefile | grep 200

interestingly, echo watch "curl ..." | xc which xc being clipboard gave me a string without "s, not sure at which step they got removed but it might bite me in the future.

Real command is watch "curl -I -s http://somefile | grep 200". . -s makes it show no progress bars etc.

Day 609


  • nachschlagen - look sth. up, retaliation, consult something quickly. TODO anki
  • massig - bulky, massive, huge. (“Massiges Gehalt”)

Intellij idea split tabs

Intellij Idea has ‘unsplit’ lower than all the other tab options :)

TODO English

Finally remember how many “d”s and “s”s are there in address. TODO anki

Intellij idea reopen closed tab

Like in browsers, it’s <Ctrl-Shift-T>; Also now it’s also u like in qutebrowser: map <leader>u :action ReopenClosedTab<CR>

Edit: Why doesn’t it work? TODO

Intellij idea / pycharm environment variables

You can copypaste the environment variables in the running configuration, including from system ones that get included to the custom ones, it understands what you want.

Ideavim / Intellij idea actionlist

Since I usually look for this here by looking for items from .ideavimrc

$Copy                                              <M-C>
$Cut                                               <M-X> <S-Del>
$Delete                                            <Del> <BS> <M-BS>
$Paste                                             <M-V>
$Redo                                              <M-S-Z> <A-S-BS>
$SearchWeb                                         <A-S-G>
$SelectAll                                         <M-A>
$Undo                                              <M-Z>
ActivateChangesToolWindow                          <M-=>
ActivateDebugToolWindow                            <M-5>
ActivateFindToolWindow                             <M-7>
ActivateMessagesToolWindow                         <M-0>
ActivatePalette	ToolWindow                        
ActivateProjectToolWindow                          <M-S-9>
ActivateRunToolWindow                              <M-4>
ActivateTerminalToolWindow                         <M-3>
ActivateTODOToolWindow                             <M-6>
AddToFavoritesPopup                                <A-S-F>
Android.TraceViewSearch                            <M-F>
Annotate                                           <C-G>
AppServers.RemoveArtifact                          <Del> <BS> <M-BS>
AutoIndentLines                                    <A-C-I>
Back                                               <M-A-Left> button=4 clickCount=1 modifiers=0 <C-[>
CallHierarchy                                      <A-C-H>
ChangeSignature                                    <M-F6>
ChangesView.AddUnversioned                         <M-A-A>
ChangesView.AddUnversioned.From.Dialog             <M-A-A>
ChangesView.Commit                                 <C-G>
ChangesView.Diff                                   <M-D>
ChangesView.Revert                                 <M-A-Z>
ChangeTypeSignature                                <M-S-F6>
ChooseDebugConfiguration                           <A-C-D>
ChooseNextSubsequentPropertyValueEditorAction      <C-Down>
ChoosePrevSubsequentPropertyValueEditorAction      <C-Up>
ChooseRunConfiguration                             <A-C-R>
ClassNameCompletion                                <A-C- >
ClassTemplateNavigation                            <M-S-G>
CloseActiveTab                                     <C-S-F4>
CloseContent                                       <M-W>
CodeCompletion                                     <C- >
CodeInspection.OnEditor                            <A-S-I>
CollapseAll                                        <M-m> <M-->
CollapseAllRegions                                 <M-S-m> <M-S-->
CollapseBlock                                      <M-S-.>
CollapseRegion                                     <M-m> <M-->
CollapseRegionRecursively                          <M-A-m> <M-A-->
CollapseSelection                                  <M-.>
CollapseTreeNode                                   <m>
com.jetbrains.php.framework.FrameworkRunConsoleAction <M-S-X>
com.jetbrains.plugins.remotesdk.console.RunSshConsoleAction <C-Z>
CommentByBlockComment                              <M-A-/> <M-A-o> <C-S-/> <C-S-o>
CommentByLineComment                               <M-/> <M-o>
Compare.LastVersion                                <C-Z>
Compile                                            <M-S-F9>
CompileDirty                                       <M-F9>
Console.Execute                                    <CR>
Console.Execute.Multiline                          <M-CR>
Console.History.Browse                             <M-A-E>
Console.Jdbc.Close                                 <C-S-F4>
Console.Jdbc.Execute                               <M-CR>
Console.Jdbc.Terminate                             <M-F2>
Console.Jpa.Close                                  <C-S-F4>
Console.Jpa.Execute                                <M-CR>
Console.Jpa.GenerateDDL                            <M-A-S-CR>
Console.Jpa.GenerateSql                            <M-S-CR>
Console.Jpa.Terminate                              <M-F2>
Console.Open                                       <M-S-F10>
Console.Oracle.DbmsOutput                          <M-F8>
Console.TableResult.AddColumn                      <M-S-8>
Console.TableResult.AddRow                         <M-N>
Console.TableResult.Cancel                         <M-F2>
Console.TableResult.CloneColumn                    <M-A-S-D>
Console.TableResult.CloneRow                       <M-S-D>
Console.TableResult.ColumnsList                    <M-F12>
Console.TableResult.ColumnSortAsc                  <A-S-Up>
Console.TableResult.ColumnSortDesc                 <A-S-Down>
Console.TableResult.ColumnSortReset                <M-A-S-BS>
Console.TableResult.ColumnVisibility               < >
Console.TableResult.DeleteColumns                  <A-S-Del>
Console.TableResult.DeleteRows                     <M-BS>
Console.TableResult.EditValue                      <F2> <CR> <A-CR>
Console.TableResult.EditValueMaximized             <S-CR> <A-S-CR>
Console.TableResult.MaximizeEditingCell            <M-A-S-M>
Console.TableResult.NavigateAction                 <M-Down> <F4>
Console.TableResult.NavigateExportedAction         <A-F7> <C-F>
Console.TableResult.NavigateForeignAction          <M-B> button=1 clickCount=1 modifiers=256 button=2 clickCount=1 modifiers=0
Console.TableResult.NextPage                       <M-A-Down>
Console.TableResult.PreviousPage                   <M-A-Up>
Console.TableResult.Reload                         <F5>
Console.TableResult.SetDefault                     <M-A-D>
Console.TableResult.SetNull                        <M-A-N>
Console.TableResult.SubmitAddedRow                 <M-CR>
context.clear                                      <A-S-X>
CopyElement                                        <F5>
CopyPaths                                          <M-S-C>
CopyReference                                      <M-A-S-C>
Coverage                                           <C-C>
Database.OpenDbStorageAction                       <M-Down> <F4>
DatabaseView.ChangeSignature                       <M-F6>
DatabaseView.CloseConnectionAction                 <M-F2>
DatabaseView.CopyAction                            <M-S-D>
DatabaseView.DropAction                            <A-CR> <C-CR>
DatabaseView.GenerateDDLAction                     <M-S-C>
DatabaseView.PropertiesAction                      <M-I>
DatabaseView.SynchronizeAction                     <M-A-Y>
Debug                                              <A-D>
DebugClass                                         <A-S-D>
Debugger.EditTypeSource                            <S-F4>
DecrementWindowHeight                              <M-S-Up>
DecrementWindowWidth                               <M-S-Left>
Diagram.DeselectAll                                <M-A-A>
Diagram.SelectAll                                  <M-A>
Diff.FocusOppositePane                             <M-Tab>
Diff.FocusOppositePaneAndScroll                    <M-S-Tab>
Diff.KeymapGroup                                   <C-Z>
Diff.NextChange                                    <M-S-]> <C-Right>
Diff.PrevChange                                    <M-S-[> <C-Left>
Diff.SelectedChange                                <M-O>
Diff.ShowDiff                                      <M-D>
Diff.ShowSettingsPopup                             <M-S-D>
Diff.UpdatedFiles                                  <M-D>
DomCollectionControl.Add                           <Ins>
DomCollectionControl.Edit                          <M-Down> <F4>
DomCollectionControl.Remove                        <Del> <BS> <M-BS>
DomElementsTreeView.AddElement                     <Ins>
DomElementsTreeView.DeleteElement                  <Del> <BS> <M-BS>
DomElementsTreeView.GotoDomElementDeclarationAction <M-Down> <F4>
DSM.Close                                          <C-S-F4>
DSM.GoToNextCycle                                  <F2>
DSM.OpenInEditor                                   <M-Down> <F4>
DumpLookupElementWeights                           <M-A-S-W>
DuplicatesForm.SendToLeft                          <M-1>
DuplicatesForm.SendToRight                         <M-2>
EditBreakpoint                                     <M-S-F8>
EditorAddOrRemoveCaret                             button=1 clickCount=1 modifiers=576
EditorAddRectangularSelectionOnMouseDrag           button=1 clickCount=1 modifiers=832
EditorBackSpace                                    <BS> <S-BS>
EditorChooseLookupItem                             <CR>
EditorChooseLookupItemCompleteStatement            <M-S-CR>
EditorChooseLookupItemDot                          <C-.>
EditorChooseLookupItemReplace                      <Tab>
EditorCodeBlockEnd                                 <M-A-]>
EditorCodeBlockEndWithSelection                    <M-A-S-]>
EditorCodeBlockStart                               <M-A-[>
EditorCodeBlockStartWithSelection                  <M-A-S-[>
EditorCompleteStatement                            <M-S-CR>
EditorContextInfo                                  <C-S-Q>
EditorCopy                                         <M-C>
EditorCreateRectangularSelection                   button=2 clickCount=1 modifiers=576
EditorCut                                          <M-X> <S-Del>
EditorCutLineEnd                                   <C-K>
EditorDelete                                       <Del>
EditorDeleteLine                                   <M-BS>
EditorDeleteToWordEnd                              <A-Del>
EditorDeleteToWordStart                            <A-BS>
EditorDown                                         <Down>
EditorDownWithSelection                            <S-Down>
EditorDuplicate                                    <M-S-D>
EditorEnter                                        <CR>
EditorEscape                                       <Esc>
EditorIndentSelection                              <Tab>
EditorJoinLines                                    <C-S-J>
EditorLeft                                         <Left>
EditorLeftWithSelection                            <S-Left>
EditorLineEnd                                      <M-Right> <C-S-E>
EditorLineEndWithSelection                         <S-End> <M-S-Right>
EditorLineStart                                    <M-Left> <C-S-A>
EditorLineStartWithSelection                       <S-Home> <M-S-Left>
EditorLookupDown                                   <C-Down>
EditorLookupUp                                     <C-Up>
EditorMoveToPageBottom                             <M-Pagedown>
EditorMoveToPageBottomWithSelection                <M-S-Pagedown>
EditorMoveToPageTop                                <M-Pageup>
EditorMoveToPageTopWithSelection                   <M-S-Pageup>
EditorNextWord                                     <A-Right>
EditorNextWordWithSelection                        <A-S-Right>
EditorPageDown                                     <Pagedown> <End>
EditorPageDownWithSelection                        <S-Pagedown>
EditorPageUp                                       <Pageup> <Home>
EditorPageUpWithSelection                          <S-Pageup>
EditorPaste                                        <M-V>
EditorPasteFromX11                                 button=2 clickCount=1 modifiers=0
EditorPasteSimple                                  <M-A-S-V>
EditorPreviousWord                                 <A-Left>
EditorPreviousWordWithSelection                    <A-S-Left>
EditorRight                                        <Right>
EditorRightWithSelection                           <S-Right>
EditorSelectLine                                   <M-A-W> <M-L>
EditorSelectWord                                   <A-Up> <M-Þ>
EditorSplitLine                                    <M-CR>
EditorStartNewLine                                 <S-CR>
EditorStartNewLineBefore                           <M-A-CR>
EditorTab                                          <Tab>
EditorTextEnd                                      <M-End>
EditorTextEndWithSelection                         <M-S-End>
EditorTextStart                                    <M-Home>
EditorTextStartWithSelection                       <M-S-Home>
EditorToggleCase                                   <M-S-U>
EditorToggleColumnMode                             <M-S-8>
EditorUnindentSelection                            <S-Tab>
EditorUnSelectWord                                 <A-Down> <M-S-Þ>
EditorUp                                           <Up>
EditorUpWithSelection                              <S-Up>
EditSource                                         <M-Down> <F4>
EditSourceInNewWindow                              <S-F4>
EmmetNextEditPoint                                 <A-C-Right>
EmmetPreviousEditPoint                             <A-C-Left>
EvaluateExpression                                 <A-F8>
Exit                                               <M-Q>
ExpandAll                                          <M-k> <M-]>
ExpandAllRegions                                   <M-]>
ExpandAllToLevel1                                  <M-A-j> <M-A-j>
ExpandAllToLevel2                                  <M-A-j> <M-A-j>
ExpandAllToLevel3                                  <M-A-j> <M-A-j>
ExpandAllToLevel4                                  <M-A-j> <M-A-j>
ExpandAllToLevel5                                  <M-A-j> <M-A-j>
ExpandLiveTemplateByTab                            <Tab>
ExpandRegion                                       <M-k> <M-S-=>
ExpandRegionRecursively                            <M-A-k> <M-A-=>
ExpandToLevel1                                     <M-j> <M-j>
ExpandToLevel2                                     <M-j> <M-j>
ExpandToLevel3                                     <M-j> <M-j>
ExpandToLevel4                                     <M-j> <M-j>
ExpandToLevel5                                     <M-j> <M-j>
ExpandTreeNode                                     <k>
ExportToTextFile                                   <C-O>
ExpressionTypeInfo                                 <C-S-P>
ExternalJavaDoc                                    <S-F1>
ExternalSystem.CollapseAll                         <M-m> <M-->
ExternalSystem.DetachProject                       <Del> <BS> <M-BS>
ExternalSystem.ExpandAll                           <M-k> <M-]>
ExternalSystem.OpenConfig                          <M-Down> <F4>
ExtractMethod                                      <M-A-M>
FileChooser.GotoDesktop                            <M-D>
FileChooser.GotoHome                               <M-1>
FileChooser.GotoModule                             <M-3>
FileChooser.GotoProject                            <M-2>
FileChooser.NewFolder                              <M-N>
FileChooser.TogglePathShowing                      <M-P>
FileStructurePopup                                 <M-F12>
Find                                               <M-F>
FindInPath                                         <M-S-F>
FindModal                                          <C-F>
FindNext                                           <M-G>
FindPrevious                                       <M-S-G>
FindUsages                                         <A-F7> <C-F>
FindUsagesInFile                                   <M-F7>
ForceRunToCursor                                   <M-A-F9>
ForceStepInto                                      <A-S-F7>
ForceStepOver                                      <A-S-F8>
Forward                                            <M-A-Right> button=5 clickCount=1 modifiers=0 <C-S-=> <C-]>
FullyExpandTreeNode                                <j> <M-]>
Generate                                           <M-N>
Git.Add                                            <M-A-A> <C-G>
Git.Branches                                       <C-G>
GoFmtFileAction                                    <M-A-S-F>
GoFmtProjectAction                                 <M-A-S-P>
GotoAction                                         <M-S-A>
GotoChangedFile                                    <M-O>
GoToClass                                          <M-S-G>
GotoClass                                          <M-O>
GotoCustomRegion                                   <M-A-.>
GotoDeclaration                                    <M-B> button=1 clickCount=1 modifiers=256 button=2 clickCount=1 modifiers=0
GotoFile                                           <M-S-O>
GotoImplementation                                 <M-A-B> button=1 clickCount=1 modifiers=768
GotoLine                                           <A-G>
GotoNextError                                      <F2>
GotoNextIncompletePropertyAction                   <F2>
GotoPreviousError                                  <S-F2>
GotoRelated                                        <M-C-Up>
GotoSuperMethod                                    <M-U>
GotoSymbol                                         <M-A-O>
GotoTest                                           <M-C-T>
GotoTypeDeclaration                                <M-S-B> <C-S-B> button=1 clickCount=1 modifiers=320 button=2 clickCount=1 modifiers=64
Graph.Delete                                       <Del> <BS> <M-BS>
Graph.Faces.OpenSelectedPages                      <M-Down> <F4>
Graph.ZoomIn                                       <k> <=>
Graph.ZoomOut                                      <m> <->
Groovy.Shell.Execute                               <M-CR>
GuiDesigner.CreateComponent                        <M-N>
GuiDesigner.CreateListener                         <M-S-O>
GuiDesigner.DecreaseIndent                         <S-Tab>
GuiDesigner.DeleteComponent                        <Del> <BS> <M-BS>
GuiDesigner.DeleteGroup                            <Del> <BS> <M-BS>
GuiDesigner.Duplicate                              <M-S-D>
GuiDesigner.EditComponent                          <F2>
GuiDesigner.EditGroup                              <F2>
GuiDesigner.ExpandSelection                        <A-Up> <M-Þ>
GuiDesigner.GoToListener                           <M-A-B> button=1 clickCount=1 modifiers=768
GuiDesigner.IncreaseIndent                         <Tab>
GuiDesigner.QuickJavadoc                           <C-J>
GuiDesigner.ShrinkSelection                        <A-Down> <M-S-Þ>
GuiDesigner.SurroundPopup                          <M-A-T>
hg4idea.QDelete                                    <Del> <BS> <M-BS>
hg4idea.QFold                                      <A-S-D>
hg4idea.QGotoFromPatches                           <A-S-G>
hg4idea.QPushAction                                <A-S-P>
hg4idea.QRefresh                                   <M-R>
HideActiveWindow                                   <S-Esc>
HideAllWindows                                     <M-S-F12>
HighlightUsagesInFile                              <M-S-F7>
HippieBackwardCompletion                           <A-S-/>
HippieCompletion                                   <A-/>
HtmlTableCellNavigateDown                          <M-A-S-Down>
HtmlTableCellNavigateLeft                          <M-A-S-Left>
HtmlTableCellNavigateRight                         <M-A-S-Right>
HtmlTableCellNavigateUp                            <M-A-S-Up>
Images.EditExternally                              <M-A-F4>
Images.Editor.ActualSize                           <M-o> <M-/>
Images.Editor.ZoomIn                               <M-k> <M-]>
Images.Editor.ZoomOut                              <M-m> <M-->
Images.ShowThumbnails                              <M-C-T>
Images.Thumbnails.EnterAction                      <CR>
Images.Thumbnails.Hide                             <M-W>
Images.Thumbnails.ToggleRecursive                  <A-j>
Images.Thumbnails.UpFolder                         <BS>
ImplementMethods                                   <C-I>
IncrementWindowHeight                              <M-S-Down>
IncrementWindowWidth                               <M-S-Right>
Inline                                             <M-A-N>
InsertLiveTemplate                                 <M-J>
IntroduceConstant                                  <M-A-C>
IntroduceField                                     <M-A-F>
IntroduceParameter                                 <M-A-P>
IntroduceVariable                                  <M-A-V>
javaee.UpdateRunningApplication                    <M-F10>
Jdbc.OpenConsole                                   <M-S-F10>
Jdbc.OpenTableEditor                               <M-Down> <F4>
Jdbc.RunQueryInConsole                             <M-CR>
Jdbc.RunSqlScript                                  <C-S-R>
Jpa.OpenConsole                                    <M-S-F10>
JumpToLastChange                                   <M-S-BS>
JumpToLastWindow                                   <F12>
MaintenanceAction                                  <M-A-S-/>
Maven.CollapseAll                                  <M-m> <M-->
Maven.EditRunConfiguration                         <M-Down> <F4>
Maven.ExpandAll                                    <M-k> <M-]>
Maven.RemoveRunConfiguration                       <Del> <BS> <M-BS>
Maven.Uml.Exclude                                  <S-Del>
MaximizeToolWindow                                 <M-S-Þ>
MethodDown                                         <C-Down>
MethodHierarchy                                    <M-S-H>
MethodHierarchy.ImplementMethodAction              <C-I>
MethodHierarchy.OverrideMethodAction               <M-S-O>
MethodUp                                           <C-Up>
Move                                               <F6>
MoveLineDown                                       <A-S-Down>
MoveLineUp                                         <A-S-Up>
MoveStatementDown                                  <M-S-Down>
MoveStatementUp                                    <M-S-Up>
MoveTabDown                                        <M-K>
MoveTabRight                                       <M-K>
Mvc.RunTarget                                      <M-A-G>
NewElement                                         <M-N>
NewElementSamePlace                                <A-C-N>
NewScratchFile                                     <M-S-N>
NextDiff                                           <F7> <C-Down>
NextEditorTab                                      <C-S-Right>
NextOccurence                                      <M-A-Down>
NextParameter                                      <Tab>
NextProjectWindow                                  <M-À>
NextSplitter                                       <A-Tab>
NextTab                                            <M-S-]> <C-Right>
NextTemplateParameter                              <Tab>
NextTemplateVariable                               <Tab> <CR>
openAssertEqualsDiff                               <M-D>
OpenModuleSettings                                 <M-Down> <F4>
OptimizeImports                                    <A-C-O>
OverrideMethods                                    <M-S-O>
PackageFile                                        <M-S-F9>
ParameterInfo                                      <M-P>
PasteMultiple                                      <M-S-V>
PerforceDirect.Edit                                <M-A-E>
PopupHector                                        <M-A-S-H>
PreviousDiff                                       <S-F7> <C-Up>
PreviousEditorTab                                  <C-S-Left>
PreviousOccurence                                  <M-A-Up>
PreviousProjectWindow                              <M-S-À>
PreviousTab                                        <M-S-[> <C-Left>
PreviousTemplateVariable                           <S-Tab>
PrevParameter                                      <S-Tab>
PrevSplitter                                       <A-S-Tab>
PrevTemplateParameter                              <S-Tab>
ProjectViewChangeView                              <A-F1>
PropertyInspectorActions.AddProperty               <M-N>
PropertyInspectorActions.EditValue                 <CR>
PropertyInspectorActions.RemoveProperty            <Del> <BS> <M-BS>
PublishGroup.UploadTo                              <M-A-S-X>
QuickChangeScheme                                  <C-À>
QuickDocCopy                                       <M-C>
QuickEvaluateExpression                            <M-A-F8> button=1 clickCount=1 modifiers=512
QuickImplementations                               <M-Y>
QuickJavaDoc                                       <C-J>
RecentChangedFiles                                 <M-S-E>
RecentChanges                                      <A-S-C>
RecentFiles                                        <M-E>
refactoring.extract.dependency                     <M-A-M>                     <M-A-V>
Refactorings.QuickListPopupAction                  <C-T>
ReformatCode                                       <M-A-L> <A-F>
Refresh                                            <M-R>
RemoteHost.NewRemoteItem                           <M-N>
RemoteHostView.CopyPaths                           <M-S-C>
RemoteHostView.EditSource                          <M-Down> <F4>
RemoteHostView.Rename                              <S-F6>
RemoveFromFavorites                                <C-Del>
RenameElement                                      <S-F6>
RenameFavoritesList                                <S-F6>
ReopenClosedTab                                    <M-S-T>
Replace                                            <M-R>
ReplaceInPath                                      <M-S-R>
Rerun                                              <M-R>
RerunTests                                         <M-C-R> <A-S-R>
ResizeToolWindowDown                               <M-S-Down>
ResizeToolWindowLeft                               <M-S-Left>
ResizeToolWindowRight                              <M-S-Right>
ResizeToolWindowUp                                 <M-S-Up>
RestoreDefaultLayout                               <S-F12>
Resume                                             <M-A-R>
Run                                                <M-A-S-R> <A-R>
RunClass                                           <C-S-R>
RunInspection                                      <M-A-S-I>
RunJsbtTask                                        <A-F11>
RunTargetAction                                    <M-S-F10>
RunToCursor                                        <A-F9>
SafeDelete                                         <M-Del>
SaveAll                                            <M-S>
SelectAllOccurrences                               <M-C-G>
SelectIn                                           <A-F1>
SelectNextOccurrence                               <M-D>
SendEOF                                            <M-D>
ShelveChanges.UnshelveWithDialog                   <M-S-U>
ShelvedChanges.Diff                                <M-D>
ShelvedChanges.Rename                              <S-F6>
ShowBookmarks                                      <M-F3>
ShowContent                                        <C-Down>
ShowErrorDescription                               <M-F1>
ShowExecutionPoint                                 <A-F10>
ShowFilePath                                       <M-A-F12>
ShowIntentionActions                               <A-CR> <C-CR>
ShowNavBar                                         <M-Up> <A-Home>
ShowProjectStructureSettings                       <M-;>
ShowSettings                                       <M-,>
ShowSettingsAndFindUsages                          <M-A-S-F7>
ShowUmlDiagram                                     <M-A-S-U>
ShowUmlDiagramPopup                                <M-A-U>
ShowUsages                                         <M-A-F7>
SmartStepInto                                      <S-F7>
SmartTypeCompletion                                <C-S- >
SplitHorizontally                                  <M-K>
SplitVertically                                    <M-K>
StepInto                                           <F7>
StepOut                                            <S-F8>
StepOver                                           <F8>
Stop                                               <M-F2>
SurroundWith                                       <M-A-T>
SurroundWithLiveTemplate                           <M-A-J>
SwitchApply                                        <A-C-CR>
SwitchCoverage                                     <M-A-F6>
SwitchDown                                         <A-C-Down>
Switcher                                           <C-Tab> <C-S-Tab>
SwitchLeft                                         <A-C-Left>
SwitchRight                                        <A-C-Right>
SwitchUp                                           <A-C-Up>
Synchronize                                        <M-A-Y>
TagDocumentationNavigation                         <M-S-D>
tasks.close                                        <A-S-W>
tasks.goto                                         <A-S-N>                                                            <A-S-B>                       
tasks.switch                                       <A-S-T>
tasks.switch.toolbar                               <A-S-T>                               
TemplateProjectProperties                          <M-;>
TemplateProjectStructure                           <A-;>
TestData.Navigate                                  <M-C-Up>
TextComponent.ClearAction                          <Esc>
ToggleBookmark                                     <F3>
ToggleBookmarkWithMnemonic                         <A-F3>
ToggleFullScreen                                   <M-C-F>
ToggleLineBreakpoint                               <M-F8>
ToggleTemporaryLineBreakpoint                      <M-A-S-F8>
UML.ApplyCurrentLayout                             <F5>
UML.ShowChanges                                    <M-A-S-D>
UnselectPreviousOccurrence                         <C-S-G>
Unsplit                                            <M-K>
UnsplitAll                                         <M-K>
Unwrap                                             <M-S-Del>
UsageView.Exclude                                  <Del> <BS> <M-BS>
UsageView.Include                                  <S-BS>
UsageView.Rerun                                    <M-R>
UsageView.ShowRecentFindUsages                     <M-E>
Vcs.Log.GoToRef                                    <M-F>
Vcs.Push                                           <M-S-K> <C-G>
Vcs.QuickListPopupAction                           <C-V>
Vcs.RollbackChangedLines                           <M-A-Z>
Vcs.ShowMessageHistory                             <M-E>
Vcs.UpdateProject                                  <M-T>
VcsHistory.ShowAllAffected                         <M-C-A>
VcsShowNextChangeMarker                            <A-C-S-Down>
VcsShowPrevChangeMarker                            <A-C-S-Up>
ViewBreakpoints                                    <M-S-F8>
ViewSource                                         <M-CR>
VimPluginToggle                                    <M-A-V>
WD.UploadCurrentRemoteFileAction                   <A-S-Q>
WebOpenInAction                                    <A-F2>
XPathView.Actions.Evaluate                         <M-A-X>
XPathView.Actions.FindByExpression                 <M-A-X>
XPathView.Actions.ShowPath                         <M-A-X>
ZoomCurrentWindow                                  <M-C-=>

(From github)1

(Escaping this is hard! Converted the <>s to their ASCII codes using HTML entity encoder/decoder, since markdown inside tags is still hard and nothing I tried worked. But one last point from the Internet - <pre> is more about aesthetics, {code} has to be used to prevent execution.) EDIT - miht have been a wrong closing tag! Anyway works now.

Day 608

Random / interesting / ideas

Emoji Simulator! 😘 -> generally, emojis are a nice way to convey information, instead of colour. Not nice but at least novel and ineresting. It would be nice to work them into some project or visualization. Мамо чому я не фронтендщик.

Day 606

Git revert vs reset last N commits

Resetting, Checking Out & Reverting | Atlassian Git Tutorial is a nice guide about ways to undo some of the commits. Reset is a harder way to undo stuff that sometimes leaves no traces, Revert is a way to create a commit that undoes the last N commits, so history is preserved and that’s good.

A way to revert the last N commits is this: 1

git revert --no-commit HEAD~3..

Two dots at the end are significant:

@cardamom Those specify a range. HEAD~3.. is the same as HEAD~3..HEAD

A saga about timezones

So. I wanted to change time back to Berlin time from Ukrainian time.

Something was wrong.

~ → timedatectl status
                      Local time: Fr 2020-08-28 18:50:55 EEST
                  Universal time: Fr 2020-08-28 15:50:55 UTC
                        RTC time: Fr 2020-08-28 15:50:55
                       Time zone: Europe/Berlin (EEST, +0300)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

UTC is right, time zone is right, but local time is wrong.

Then I google and see that Europe/Berlin is actually EEST, +0200!

Then I realize the following:

Last time I needed to change the time, I changed the timezone, by doing:

sudo cp /usr/share/zoneinfo/Europe/Kiev /etc/localtime


/etc/localtime was a SYMBOLIC LINK to /usr/share/zoneinfo/Europe/Berlin

~ → file /etc/localtime
/etc/localtime: symbolic link to ../usr/share/zoneinfo/Europe/Berlin

By doing that, I rewrote the Berlin timezone by making it Kyiv, changing the time on my computer and changing the Berlin timezone itself.

Fixed this with a bandaid by making my timezone Europe/Rome, as /usr/share/zoneinfo/Europe/Rome was never overwritten.

↑130 ~ → timedatectl status
                      Local time: Fr 2020-08-28 17:59:15 CEST
                  Universal time: Fr 2020-08-28 15:59:15 UTC
                        RTC time: Fr 2020-08-28 15:59:15
                       Time zone: Europe/Rome (CEST, +0200)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no

Happy end.

Day 604

VPN DNS issues

Seemed to have a conflict w/ IPv6 VPN vs the IPv4 one, first had priority. Then I had an issue where the VPN IP was the same as the IP of my router. Fixed by moving router IP. Learned a lot about how DNS works.

Lookup website using particular DNS

  • nslookup looks up the website using the provided DNS server.
  • systemd-resolve --status gives the current DNS settings.
  • sudo systemd-resolve --flush-caches flushes the DNS caches.

Day 589

git diff with full context

How to get git diff with full context? - Stack Overflow - git diff -U1000000 - or wc -l in place of the number - any number of line larger than the file works.

Intellij idea test results CLI output w/ ideavim

The window w/ CLI output or test output can be happily manipulated with ideavim! Now I can copypaste everything easily!

Day 586

Jupyter Notebook vim mode

When operating on cells, not text (= not insert mode), the usual j/k commands select cells when shift is used (J/K). This is neat. I should read the documentation.

Java brackets in for statements

If you have only one statement in for loops, you can drop the brackets:

for (final String dt: distanceTypes)
    for (final double co : cutoffs)

That said, it’s not a good idea :) Answer has details about the definitions, default scope for for is next statement. A statement can have brackets.

for loop without braces in java - Stack Overflow

Ideas / TODO / Fiamma / PKM

Possibly sometime rewrite my link wiki (’s bookmarking userscript to accept data as title/complexity/rating/tag1 two three/Cat1 cat2 cat3 instead of the current multiline thingy, might be even easier to fit it into a userprompt

Random / interesting

Day 585

Jaro-winkler similarity for empty strings (#nlp)

Jaro-Winkler handling empty strings · Issue #28 · tdebatty/java-string-similarity - TL;DR officially ‘undefined’, what has to be returned in implementations depends on why you need it. These are nice edge cases I have to learn to watch for.

String similarity algo explained

String simularity has a nice table with similarity algos and how they perform with different changes.

String sim algorithms.

Day 584

Git diff

Is much more flexible than expected. git diff --unified=0 doesn’t show the context lines, only the changed ones; in general the documentation is worth reading, could be a good tool to add to my belt for various one-off tasks.

pandas convert entire dataframe to str / value type

df.applymap(str) converts everythnig to str. df.applymap() applies a function to a Dataframe elementwise. (TODO anki)

pandas import numpy

If I don’t want to do import numpy as np separately (for things like np.nan), works! 1

pandas remove NaN/nan in str

np.nan in the dataframe can be removed w/ df.fillna(''), but after getting converted to string the NaN become nan and have to be removed by the string operation. As a string operation, it’s important to watch out for strings containing nans, for example:

pd.DataFrame({'one':['two','three','four',,23,'nonanme']}).applymap(str).replace('nan','',regex=True) would change the last element. All answers here seem to have this issue.

So to remove them from a string representation, pd.DataFrame({'one':['two','three','four',,23,'nonanme']}).applymap(str).replace('^nan$','',regex=True) works, with a regex for nan.

qutebrowser leave passthrough mode

Changed keybinding to config.bind('<Ctrl-Shift-+>', 'leave-mode', mode='passthrough'), which translates to <C-S-=>, but it seems to see = as + because Shift is being pressed.

Day 583

Diff character-level differences highlights

command line - Using ‘diff’ (or anything else) to get character-level diff between text files - Stack Overflow gives this one nice string: git diff --word-diff=color --word-diff-regex=. file1 file2 which gives red/green characters for deletions/additions. Also, chaining greps also works nicely with grep -o which passes only the text of the actual match. Grep doesn’t support capturing groups.

Day 582

Intellij idea CheckStyle plugin

CheckStyle-IDEA - plugin for IntelliJ IDEA and Android Studio | JetBrains exists and I had better luck w/ it than with importing the checkstyle file from Style in Settings. Gives highlights inside the code itself automatically.

Intellij idea - “Add comment” style - put them before the text, not at first column

  • Can be set in “Code generation”: Action gets used w/ Ideavim’s gcc etc.

    To configure settings for where the generated line or block comments should be placed in Java, in the Settings/Preferences dialog Ctrl+Alt+S, go to Editor | Code Style | Java and on the Code Generation tab use options in the Comment Code section. 1

Intellij Idea Checkstyle highlights

Intellij Idea Checkstyle highlights seem to refresh when I change a character and similar edits, but not when I change indentation w/ IdeaVim.

Intellij idea Rainbow CSV plugin

Rainbow CSV plugin is nice and highlights columns of the CSV in different colours - something I didn’t know I needed.

Checkstyle documentation

checkstyle – Imports explains (“Rationale:”) the rules used and in general is quite well-written.

Checkstyle equalsavoidnull

"My_Sweet_String".equals(nullString); is the way to go for string comparisons apparently, it avoids potential nullPointerExceptions. 2

String similarity algorithms in Java

tdebatty/java-string-similarity: Implementation of various string similarity and distance algorithms: Levenshtein, Jaro-winkler, n-Gram, Q-Gram, Jaccard index, Longest Common Subsequence edit distance, cosine similarity … is awesome.

A library implementing different string similarity and distance measures. A dozen of algorithms (including Levenshtein edit distance and sibblings, Jaro-Winkler, Longest Common Subsequence, cosine similarity etc.) are currently implemented.

String similarity / string distances normalization #nlp

algorithm - Normalizing the edit distance - Stack Overflow has info about normalizing distances like Levenshtein etc. And how a normalized distance is not a metric anymore, as it violates the Triangle inequality w/ sum of two sides of the triangle not being longer than the third.

Longest common subsequence

Longest common subsequence problem - Wikipedia is different from Longest Common Substring is that subsequences are not required to be uninterrupted.

Day 578

Random / Interesting

!Bernard Moitessier’s tomb is Bernard Moitessier’s tomb.

Intellij idea source code navigation

  • ` to navigate to last edited location

… though most of this is helpfully configurable in ideavim; esp: map <leader>b :action GotoDeclaration<CR>1 for “go to declaration”, which is <Alt+B> in vanilla ideavim. I should track things I use my mouse for most often and replace them with ideavim shortcuts.

Lenovo Thinkpad disable Fn key

Nice that I don’t have to use BIOS for this. <Fn+Esc> disables Fn key functionality.

Day 577

Random / books / to read

Mediawiki change allowed filetypes

$wgFileExtensions = [
    'png', 'gif', 'jpg', 'jpeg', 

Day 576

Random / interesting / English

  • Avunculicide is the act of killing an uncle. First heard on Brooklyn 99, S5:E3

Day 575

Intellij idea run class with cursor

The small “play” symbols to the left on some classes can be run w/ <C-S-F10> if cursor is on them currently.

Java supports labels!

Java label? Outer, middle, inner - Stack Overflow

    for (i = 0; i < 100; i++) {
        for (j = 0; j < 100; j++) {
            if (i % 20 == 0) {
                break someLabel;

Used to tell break/continue.. which loop to act on.

Random / style / writing

Calling your example classes as something that might be interpreted as a keyword of the language you are writing a tutorial about is a bad idea. (Outer here: Java Nested Classes)

Java collections

Java Collections Tutorial is a really nice tutorial by the author of the other java really nice tutorial I’ve been following.

Day 574

Python do something based on probability

python - True or false output based on a probability - Stack Overflow mentions a really neat idea:

def decision(probability):
    return random.random() < probability

Day 572


TODO finally read the man page and learn to use it right, esp. splitting; look at history for the usual things I do manually (esp. moving back starting time)


In my daily file, I need a better vim shortcut not to move lines to the very bottom, but to the beginning of the following day (===), should be easy - TODO

Day 571

Intellij idea breakpoints with no executable code

So here’s a nice difference w/ Python - in Python, you can set breakpoints everywhere, and you can add something random after the line you want to look at if it’s the last line of the function. In java, I assume some pointless lines are optimized away or considered uninteresting, but you can set a breakpoint to the } bracket and the end of the function if it’s on a line alone.

(Have yet to find a way to nicely output multiple values in the debugger though.)

Intellij idea “Execute code” during debugging

What I could do in Python with 2, 3, 'test', function() I can do in Java by returning an array or whatever, with

Object[] t = {1, 3, 5, "whatever"}

Which is nicely covered by this Live template:

Object[] t = {

that I run via exe<Tab>

Day 570


Did a lot of python, pandas, jupyter and enjoyed it so much that did not write any of the things I learned here, now they are lost forever. :’C

Sonderurlaub / Germany / Bureaucracy

Sonderurlaub: Anspruch bei Hochzeit, Todesfall & Umzug | - doesn’t get counted in the the number of days for ‘usual’ vacations.

  • Geburt des eigenen Kindes – 1 Tag
  • Tod des Ehepartners bzw. eingetragenen Lebenspartners – 2 Tage
  • aus betrieblichen Gründen erforderlicher Umzug in eine andere Stadt – 1 Tag
  • beim 25-jährigen und beim 40-jährigen Arbeitsjubiläum – 1 Tag
  • bei schwerer Erkrankung eines im Haushalt lebenden Angehörigen – 1 Tag/Jahr
  • bei schwerer Erkrankung eines Kindes, welches das 12. Lebensjahr noch nicht vollendet hat – bis zu 4 Tage/Jahr
  • zwingende ärztliche Behandlung, die nicht außerhalb der vereinbarten Arbeitszeiten erfolgen kann – Dauer ergibt sich aus An- und Abfahrtszeiten plus Behandlungszeit 1

First time I’ve seen anchors in real life

The copied link was:,-Die%20Entscheidung%2C%20den&text=Zwar%20erw%C3%A4hnt%20%C2%A7%20616%20BGB%20die%20Hochzeit%20nicht%20ausdr%C3%BCcklich%20als%20Freistellungsgrund.&text=Nicht%20nur%20f%C3%BCr%20die%20eigene,Die%20Silberhochzeit%20(25.) which of course broke the Markdown. TODO update ym qutebrowser keybinding to remove stuff starting with … #:~: maybe?

Day 569

Jupyter Notebook vim plugin copypaste

Things that I selected with vim keybindings can be copypasted with usual qutebrowser keybindings (or mouse).

Libreoffice calc search by regex

You can do it if you go in the find-and-replace dialog. Checkbox -> search all

Inverse regex

.. is surprisingly hard and implementation-dependant. You can always iterate and look for the not-matched things. [^aeo] doesn’t really work for capturing groups.

Day 568

Random / TODO / Linux

I should really rewrite my timer function to be a) Python, b) better than the current version.

# Timer in zsh
tm() {
    local DATE=$(date +'%H:%M:%S %d/%m')
    local N="$1"; shift
  (utimer -c > ~/s/sounds/outbash $N && mpg123 -q ~/s/sounds/tib.mp3  &
      zenity --info --title="Time's Up" --text="${*:-BING} \n\n $DATE")

utimer seeing minutes as m while everyone else (timew especially) wanting minutes as min makes me crazy.

Intellij idea

I can remove the tree of files by doubleclicking the tabs!

Intellij idea debugging paste

<Ctrl-Shift-V> gives a nice choice of things to paste, first thing being the current content of the buffer. The others I assume are historical.

Quotes in german / Random / Interesting / TODO

punctuation - What is the correct way to denote a quotation in German? - German Language Stack Exchange TODO read

Day 567

Intellij idea almost-tree tabs

In Tabs Config you can select a small font for them and move them to the left instead of top.

Day 564

Intellij idea project dependencies / maven / magic

I had two projects, one used code from the other one. The other one is also compiled jars gotten via maven. Had an issue that it used the maven one instead of the manually imported one I wanted it to use, even though Ctrl+Click took me to the ‘right’ directory with the files I wanted it to see.

Sorted out via Project Structure -> Modules -> $modulename -> dependencies, where I deleted the maven one and pointed it to the imported folder/project

Random / quotes / coronavirus

People seem to have a naïve view of what “cured” means: someone “gets sick”, is treated, and then returns to the status quo ante. Thus there is little concern about catching the disease (or any disease) when you are not in an “at risk” group.

But hospital discharge just means the treatment you get stops being worth the time/money. Ideally you finish convalescing at home. But any consequential damage isn’t ignored, as if you just had had a dented panel replaced on your car.

Once I understood this error some of the discussion about dealing with the virus made sense.1


Day 563

Work / OCR

Paper about the common OCR errors, containing statistical info about them and having nice clear lists w/ probabilities.

German, English

Stachelbeere – Wikipedia ist Крыжовник. English - Gooseberry.

Libreoffice Calc

Libreoffice Calc automatically replaces “ß”<->”ss”, unless you tick “Match case”.

Intellij idea opening files in splits

You can drag and drop files to the split you want to open them into.

Magic numbers in hash functions

algorithm - Reason for 5381 number in DJB hash function? - Stack Overflow is a nice answer about why numbers may be chosen.

Day 562

Random / podcasts / quotes

  • MLOps. Entwurf, Entwicklung, Betrieb – INNOQ
  • Unix culture values code which is useful to other programmers, while Windows culture values code which is useful to non-programmers. 1

  • Crippleware - Wikipedia means that “vital features of the program such as printing or the ability to save files are disabled until the user purchases a registration key”


treble - …triple.

Intellij idea search through debugger

I can search through the variables in the debugger by just typing, without any / shortcut.

Edit distance

String Similarity Algorithms Compared | by Appaloosa Store | Medium compares different edit distance algos, TODO

Day 561

Random / interesting

Third-party doctrine - Wikipedia - is a United States legal doctrine that holds that people who voluntarily give information to third parties—such as banks, phone companies, internet service providers (ISPs), and e-mail servers—have “no reasonable expectation of privacy.”

Keyboard layout / compose

Changed line to setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin, compose:paus' v5,ruua &, now the Pause key works as compose too. Will check whether the RWIN works back at home with the keyboard that has a RWIN. 1

vim macro

For markdown references, updated my old @R macro to add an additional /Enter before the actual reference part, so it's gets parsed correctly:

let @R = 'viw"oyi[^^[^[^[^[A]^[^[^[Go^M[^^[^[^[^["opA]: ^[^[^[^['et @R = 'viw"oyi[^A]Go [^"opA]: '

For the ^M/Enter, I used the old <C-v><Enter> trick. 2

intellij toolbox app

The Toolbox app is actually not bad at all and quite easy to use and the things it installs can actually be run from CLI. It also recognized my manually downloaded intellij - which raises the question how did it do that.

EDIT Do 17 Sep 2020 07:29:48 CEST: but of course the environment variables set in ~/.zshrc are not going to be set if you launch the toobox app not via CLI. ~/idea/bin/ remains my favourite method.

maven documentation / skipping tests

Maven Surefire Plugin – Skipping Tests has nice info and its readable, and I should read through the maven documentation sometime.

To skip maven tests: mvn install -DskipTests

Qutebrowser devtools

1) Are not enabled if I don’t import the virtualenv before running qutebrowser 2) Can be happily moved to a separate window by :devtools window


Added these two nice functions to zsh, for work and not-work:

tt () {task s project:w  "$*"}
th () {task s \($(date +%-V) or sprint:c \) project.not:w "$*"}

Day 557

Timewarrior / timew

If I track something tagged ‘daily’ it sees it as <duration> and I get syntax error.


Randfälle - edge cases; TODO add to anki


Random / quotes / meditation

However, in general, when meditating, you take the mind as you find it and work from there. There’s no particular way the mind has to be. (Reddit)

Identify an unknown process in linux

Found something called “HUNT” in htop taking A LOT of my CPU. Process with randomized name - Unix & Linux Stack Exchange:

Check its process ID, and look at ls -l /proc/process_id/ to see e.g. what the executable is (the exe symlink).

exe symlink pointed to /usr/sbin/huntd, which was easy to Google, and which turned up to be one of the bsdgames I tested earlier that still had its daemon running. I’ll remember this trick.

(Why did it take so much memory is still a mystery but I’m not that interested to check).

Day 556

Random / Interesting / patterns

“If it takes water lilies that double their spread every day 50 days to cover the entire lake, on what day would they cover a half of that lake?”

The answer, obviously, is day 49. More to the point, day 45 would have had only seen the lilies cover 3,125% of the lake. Day 40 would have had been 0,0976% - from that little of an amount, the lilies would proceed to take over the entire lake in 10 more days.

So, it’s the same way with this pandemic. I think there now enough of an evidence from anywhere in the world to say that absent an (effective, early) intervention to lower R0 inside the country, it takes about 3,5 months for the virus to blow up into a devastating contagion. 1

Intellij idea environment variables

Intellij reads environment variables only at startup, and there’s no way to refresh them. Even “Restart”-ing it via the menu didn’t help, I think I need to physically restart the process.

UPD: Even restarting the process doesn’t work if I don’t (re)start zsh (and make it read the new variables in .zshrc) in the terminal where it’s running! Which actually makes sense.

Intellij idea git annotate

VCS -> Git -> Annotate is basically git blame. It shows the last person who modified each particular line and when.

Qutebrowser ‘open in private window’

:open -p {url} opens url in private window. qutebrowser --temp-basedir -s content.private_browsing true also works.

Random / Interesting / Languages

Circumfix - Wikipedia is when something gets added both to the beginning and the end of a word; same cluster as prefixes/suffixes. Examples are German “ge…t” and “най…чший” for German/Russian.

Random / IT

Diving in the current codebase I’m reading through, I realize just how awesome are tests to understand unknown code. The usual “change stuff and see what happens” is much easier if it’s all nicely insulated, with hardcoded values, and providing examples of how to use the code. I’ll remember this.


To finally save my answers to the notifications, added config.load_autoconfig() to as per qutebrowser/configuring.asciidoc at master · qutebrowser/qutebrowser

Day 555

Java jar/fatjar shaded dependency

libraries - What is a shaded Java dependency? - Software Engineering Stack Exchange

Shading dependencies is the process of including and renaming dependencies (thus relocating the classes & rewriting affected bytecode & resources) to create a private copy that you bundle alongside your own code.

To Shade a library is to take the contents files of said library, put them in your own jar, and change their package. This is different from packaging which is simply shipping the libraries files in side your own jar without relocating them to a different package.

Recovering corrupt textfiles / strings / fc builtin shell command

How to fix and recover zsh: corrupt history file /home/…/.zsh_history error

strings .zsh_history_old > .zsh_history
fc -R .zsh_history

strings gives the strings (=printable characters) in a file;


fc is freaking awesome. Linux and Unix fc command tutorial with examples | George Ornbo

Running fc opens a text editor w/ the last command, closing it runs the command you edited. On my box it opens vim. This is so going to help me with long commands oh my God. Much better than the faux-vim syntax that I have in zsh. I’ll be able to use ci) and other things I always missed.

fc -l, fc -l 100, fc -l 100 200 lists the last commands ran (or a range). fc -ln doesn’t print their numbers. -d gives timestamps, -f for full timestamp in US format, -fE for the usual one.

Day 554

Intellij / Java / Maven

  • $JAVA_HOME does not get necessarily set and has to be set in maven runner settings (Build/exec/dev -> build tools -> maven), or in environment variables.
  • Maven goals’ order sometimes matters (who knew)

History is happening


Day 553


  • subsume - Wiktionary
    • To place (any one cognition) under another as belonging to it; to include or contain something else.
    • To consider an occurrence as part of a principle or rule; to colligate
  • crass - Wiktionary - Lacking finesse; crude and obvious.

Random / interesting

Scrum / Agile

  • Full Comparison: Agile vs Scrum vs Waterfall vs Kanban is a nice resource.
  • TL;DR Scrum is a subset of Agile, with more focus on Sprints + team accountability, and much more prescriptive / ritualized.
  • Agile describes a set of principles in the Agile Manifesto for building software through iterative development. On the other hand, Scrum is a specific set of rules to follow when practicing Agile software development. **Agile is the philosophy and Scrum is the methodology to implement the Agile philosophy. **


  • autark – Wiktionary - von außere [wirtschaftliche] Einflüssen unabhängig.cmp autarkic in English = self-sufficient.
  • Quality Gate – Wikipedia
    • Quality Gates sind Punkte im Ablauf eines Entwicklungsprojekts, bei denen anhand von im Voraus eindeutig bestimmten Qualitätskriterien über die Freigabe des nächsten Projektschrittes entschieden wird.[1]

Day 550

Random / interesting / cats

Существует «теория благополучия животных», которая определяет «пять свобод», необходимых животным, которые живут рядом с человеком:

  • свобода от голода и жажды;
  • свобода от дискомфорта;
  • свобода от травм и болезней;
  • свобода поведения, характерного для вида животного;
  • свобода от горя и страданий. 1


Java ternary operators

Java has ternary operators! Java Ternary Operator

String value = object != null ? object.getValue() : null;

Java subclassing something w/ private fields

java - Do subclasses inherit private fields? - Stack Overflow is pretty split by opinions. TL;DR they are inherited as they are used by the methods in the superclass, but you can’t use them in the subclass.o

Since the subclass can’t access or modify the private fields, then, in other words, they are not inherited. But there really is just one object, it really does contain the private fields.

So classes do not inherit them, but the object does. And the JLS (Java SE Specifications) is the Bible.

History is happening

Santa Cruz County Beaches Officially Reopen Due to Public Ignoring Beach Closure

Day 548

Java Tutorial

Java Constructors is a nice series of Java tutorials! I’ll be following it to remember everything I’ve forgotten about java.

Intellij Idea has a lot of shortcuts!

sout -> System.out.println() and a lot of other similar ones, TODO find full list.

Random / Interesting

A Bolo tie is a weird kind of tie popular in the Western US; first found in “Pill Mills of Florida” creepypasta.

History is happening

Catholic priest, laity defend statue of St. Louis as leftist protestors become increasingly violent | News | Lifesitenews

Day 546

History is happening

Seen a nice newspaper in Italy from something like March 3: “$cityname: first person healed, one in reanimation”.

Also in the plane they give instructions about what to do if there’s a loss of cabin pressure: you take your mask off before you wear the oxygen one.

Day 540


Finally fixed the zsh function and tw command to be able to filter the output by adding escaped parentheses:

s () {task s \($(date +%-V) or sprint:c \) "$@"}

That said,

When they are not quoted, $* and $@ are the same. You shouldn’t use either of these, because they can break unexpectedly as soon as you have arguments containing spaces or wildcards. 1

random / todo

Create a better vim macro that automatically generates some random text for the reference.

Day 532

Day 530

Random / Interesting / English

Soapbox - Wikipedia - A soapbox is a raised platform which one stands on to make an impromptu speech, often about a political subject. The term originates from the days when speakers would elevate themselves by standing on a wooden crate originally used for shipment of soap or other dry goods from a manufacturer to a retail store.

Random / Interesting

Playlist (Psilocybin for depression, Imperial College London, version 1.3) by Mendel Kaelen | Mixcloud

Day 527

Random / interesting / ety / History is happening

Trending Words

  1. blacklist
  2. family
  3. race
  4. master
  5. chauvinism
  6. human
  7. sand
  8. blackmail
  9. racism
  10. nice


Numpy reading from text and discarding comments

numpy.genfromtxt — NumPy v1.18 Manual - lines starting with “#” get discarded by default.

Day 526

Random / Interesting

I really need to sort out where do I put my links, my short-form descriptions of links, my ideas, longer-form things if any.

I need to focus on “being happy” again; I know what to do, how to do it, and objectively - I have time for this.

All of the white people who joined Indian tribes loved it and refused to go back to white civilization. All the Indians who joined white civilization hated it and did everything they could to go back to their previous tribal lives. 1

The Happiness Lab is relevant.

I need to synthesize this all in one nice post or article or work on progress or whatever.

Day 522

Random / interesting

Sai - Essays: Meditation & energy work techniques

“It’s simple but not easy”

Intellij Idea / vim plugin / easymotion

Day 521

You can write raw SVGs into HTML!

Just wow, I had no idea you could do that:


<line x1="0" y1="0" x2="10" y2="10" stroke="black"></line>
<rect x="0" y="0" width="10" height="10"></rect>
<circle cx="5" cy="5" r="5"></circle>
<ellipse cx="10" cy="5" rx="10" ry="5"></ellipse>
<polygon points="0,0 10,5 20,0 20,20 10,15 0,20"></polygon>
<polyline points="0,0 10,5 20,0 20,20 10,15 0,20" stroke="black"></polyline>
<path d="M65,10 a50,25 0 1,0 50,25"></path>

(Found here: An introduction to d3.js in 10 basic examples)

Day 520


I rest my case | meaning in the Cambridge English Dictionary: - “what just happened proves my point” - said by lawyers in a law court when they have finished the explanation of their case


For weird stuff like symbols hard to escape and deleting annotations or whatever, the edit command exists that opens vim and makes everything very easy.

numpy getting started

The Basics of NumPy Arrays | Python Data Science Handbook is a nice refresher on the numpy basics.


grundlegend | Übersetzung Englisch-Deutsch is ‘basic’. I was confusing it with gründlich | Übersetzung Englisch-Deutsch, which is closer to ‘exhaustive’

Python unzip

To do the reverse of zip(), the way is list(zip(*previously_zipped_data))

Day 514

Hypermodern python

Hypermodern Python · Claudio Jolowicz It has basics on how to write/run/publish a Python app in 2020, which is nice. Uses poetry and stuff. I don’t have much knowledge in such things. But next project I do will use some of the ways described in there, there’s no consensus on how to do it right but what’s described there is much better than nothing.

Project idea

Yet another nice unfinished project! I need something to unite flashcards and actual study material. I see something that gets markdown flashcards as input, and generates (via genanki1?) actual flashcards to be imported into anki, but also (with pandoc?) nice readable latex/HTML thinges in column (a la “The little schemer”) form to review it better and/or print.

This is something I really miss now, since anki_import has some issues but I don’t want to learn perl to fix them. And I’d need the column format output.

qutebrowser bindings with specifying mode

Added this to

config.unbind('<Shift-Escape>', mode='passthrough')
config.bind('<Ctrl-Shift-Escape>', 'leave-mode', mode='passthrough')

Now I can use <Shift+Escape> in vim-mode of Jupyter Notebook! It’s used to go from insert mode inside a cell to operate on the cells themselves. I missed this. Additionally my bindings of “Ctrl” as “Escape” when clicked fast seem to work also inside other bindings! As in <Shift-fastCtrl> works as <Shift-Escape>. Wow.

Random / youtube-dl

Youtube-dl can download video from Reddit! Such as will she fall? (tutorial link in comment) : animation

Day 509

Python backslashes and raw strings

Why can’t Python’s raw string literals end with a single backslash? - Stack Overflow - raw strings are not that raw and can’t end in a single backslash.

New vim highlight rules for markdown files

fun! SetBackslash()
    syn region mys matchgroup=ignore start=/^\s*\\/ end=/$/ oneline
    hi link mys EndOfBuffer

fun! SetQuestions()
    syn region dash matchgroup=ignore start=/^\s*\\+/ end=/$/ oneline
    hi link dash Statement

" fun! SetQuestions()
"     syn match mys /^\s*+.*$/
"     hi link mys Keyword
" endfu
autocmd filetype markdown :call SetBackslash()
autocmd filetype markdown :call SetQuestions()

Vim increase/decrease number under cursor

Ctrl+a increases the number under the cursor, \ Ctrl+x decreases the number under the cursor.

Interesting / Random

Day 508


An Ermine, aka Stoat, is the thing Lady with an Ermine holds.

Lady with an ermine by Da Vinci.


Hotlinking is allowed from Wikimedia servers, but not generally recommended: this is because anyone could change, vandalise, rename or delete a hotlinked image. 1

First found in The Trouble with Tribbles which I found through Voltaire - The Trouble with Tribbles (Song Only) - YouTube

Day 507

Vim easymotion

Changed the default <Leader><Leader> mapping to s, that I never use, now everything is much easier!

Intellij Idea vim plugin

The * thing to search for word under cursor also works!

Random / Quotes

“Шредингеров кот” (с) Андрей

Day 506

“Vim plugins I use” + read man pages with vim

Vim plugins that I use, Read man pages with vim

The last one is freaking awesome.


spunk - spark (fire); courage, spirit, determination.

Vim new highlight groups

fun! SetBackslash()
    syn region mys matchgroup=ignore start=/^\\/ end=/$/ oneline
    hi link mys EndOfBuffer

fun! SetQuestions()
    syn region dash matchgroup=ignore start=/^\\\s*+/ end=/$/ oneline
    hi link dash Statement

The backslash is a way to mark “pre-written” things is my todo files. Anything after them is special. The backslash itself doesn’t get shown (matchgroup=ignore), everything else either is colored as EndOfBuffer (blue) or, if it starts with a +, as Statement (=yellow).

I’ll play with the colours a bit more later.

matchgroup=1 is the colour in which we’ll print the things that are actually matched as start/end, can be different from the thing demarcated by them.

Day 504

Python generator expressions are a thing

How to Use Generators and yield in Python – Real Python:

>>> nums_squared_lc = [num**2 for num in range(5)]
>>> nums_squared_gc = (num**2 for num in range(5))

The second one is a generator expression, with all the nice memory thingsies that entails.

In general How to Stand Out in a Python Coding Interview – Real Python has some very interesting bits I had no idea about.

And from “Dive into python”, p.193:

Using a generator expression instead of a list comprehension can save both RAM and CPU. If you’re building an list just to throw it away (e.g. passing it to tuple() or set()), use a generator expression instead!

Generator expressions are functionally equivalent to generator functions.

Python itertools

The itertools module has a lot of awesome stuff! 1

cycle, count, repeat, etc etc etc.

Scary to think how many hours of coding I could have done over my lifetime if I hadn’t read this.

#!/usr/bin/env python and the env trick for running stuff

From the Learning Python 5th Edition book, Chapter 3 page 60:

#!/usr/bin/env python
...script goes here...

This is fascinating. The env $whatever command returns the location of $whatever, which may or may not be standard. And apparently this is the way to write trueъ portable scripts.

This goes to show that reading some nice reference line-by-line is actually a good thing if you have basic random bits of knowledge about something.

So currently:

  • Finish Diving into Python, at least the parts I feel are relevant If I decide I need more Python in my life,
  • Learning Python 5th edition, 1594 pages, focuses on the Python language which is the official prerequisite to…
  • Programming Python, 1628 pages. It focuses on libraries and tools.

The latter two have actual “Test your knowledge” tests and exercises.

All of them may or may not be helpfully available illegally online, especially on github, especially in a repo I cloned.

Day 501

Port knocking and using ports based on IP

My latest trick for deciding on external ports to forward is to combine the service port and the device’s internal IP address. If my desktop was and the service was SSH on port 22, the external port would be 22136. So far it’s worked well, but it only really works if you force your router to only give out through (snazz @ Port knocking | Hacker News)

Also: Port knocking is a method of externally opening ports on a firewall by generating a connection attempt on a set of prespecified closed ports. Once a correct sequence of connection attempts is received, the firewall rules are dynamically modified to allow the host which sent the connection attempts to connect over specific port(s). 1

Random / Interesting

I’ve noticed a similar way of counting that’s still quite common today in China. They point with their thumb to each segment of their four fingers to count up to 12 on one hand. The other hand tracks the number of 12 counts, which lets you keep track all the way up to 144 with both hands. (modo_ at Roman Finger Counting | Hacker News)


All thumbs - Fig. very awkward and clumsy, especially with one’s hands.

uncouth - clumsy, awkward, unrefined, crude.

Day 499

Random / Interesting / Quotes

My favourite quote by Kerouac has a fuller version I forgot exists:

“I don’t know, I don’t care, and it doesn’t make any difference.” ― Jack Kerouac

From the 1-to-1: “You always meet twice in life”

Tensorflow / ML

Binary crossentropy is a special case of categorical crossentropy, for when you have one output.

Zsh / Bash history

I can use syntax like !10600 inside commands in the CLI! They get replaced when needed.

Compressing PDF

pdf2ps input.pdf ps2pdf -dPDFSETTINGS=/screen -dDownsampleColorImages=true -dColorImageResolution=200 -dColorImageDownsampleType=/Bicubic output.pdf , and you can tune dColorImageResolution. Out of all answers in that thread 1, it’s the only one that decreased my 2.3M pdf to 1.3MB. (Needed less than 2MB)

Day 497

Random / Interesting / Quotes

If their absence brings you peace, you didn’t lose them.

Vim read from stdin

whatevercommand | vim - works nicely for some of the commands I’d usually use less for.

Related TODO: that vim plugin to read man pages and the website I found it on.

Day 495

Random / interesting

  • fantascienza Problemi di pelle Sebastiano Diciassette

  • I feel like writing better reviews of the books I read on Goodreads or my blog. I miss having to put things into words, and one of my New Year’s resolutions one of the previous years has been “Less consuming, more creating. Doesn’t matter what it is, doesn’t matter if it’s bad.”, stolen from HN. There’s definitely something to it. Along with this quote:

    “Write it. Shoot it. Publish it. Crochet it, sauté it, whatever. MAKE.” ― Joss Whedon

Also, from the Onion:

This is America. Nobody deserves to be treated as a black man. Judge Rules White Girl Will Be Tried As Black Adult - YouTube

Day 494

DTB Todo

Analyzing this DTB would make for an interesting blog post, especially by plotting the frequency of words in the headers, length, time of the day they were created. Same goes for the link wiki. Same goes for list of URLs and graphing the number of them returning 404s or similar.

I also want to create better Python scripts that join everything to the master file (Master file | Diensttagebuch) with better formated dates.

Day 493

Rsync to slash or not to slash

This definitely goes into anki: Rsync – To Slash or Not To Slash? – Rants & Raves – The Blog!

Without a slash on the source directory means copy both the source directory, and the contents (recursively if specified) to the destination directory while adding a trailing slash means only copy the contents of the source directory, recursively if specified, to the destination. Without a slash on the source directory means copy both the source directory, and the contents (recursively if specified) to the destination directory while adding a trailing slash means only copy the contents of the source directory, recursively if specified, to the destination.

TL;DR: #anki

  • Source directory:
    • Slash: copy the contents of the source directory, without the directory itself
    • No slash: copy both the directory and its files
  • Destination directory: doesn’t matter

The difference between /target/source/source_content and /target/source_content.

Usually I want slash.

To memorize, the slash represents the contents of the directory in some way.

Also nice handy command tree that I didn’t know I needed.

grep excluding matches

On the topic of the things I keep forgetting: grep -v excludeme, mnemonic might be reVerse? #anki

rsync show progress

rsync -ra --info=progress2 source target #anki

Usually this is what I want, otherwise there’s pv that I could never get to work reliably

Random / Interesting / Ukrainian

Хештег - Як перекладається слово Хештег українською - Словотвір

З огляду на технічну складову питання додам коротке обґрунтування назви “кришмітка”. Слово hash-tag отримало таку назву не просто із-за символа “решітка”, причиною використання цього символа є скорочення написання слова hash-tag, коріння якого по своїй суті заходить глибоко в науку про компьютери. Розробники використовють слово hash як скорочення слова dictionary (словничок) що є спеціальною структурою даних котра пришвидшує пошук. Hash-tag або “#tag” з технічної точки зору означає те що слово “tag” проіндексується (потрапить у індекс або іншими словами словничок) і надалі буде доступне для швидкого пошуку. Тепер про саме слово hash, у тій же компьютерній науці існує багато стуктур даних здатних виконувати роль словничка. Hash-словнички особливі тим що використовують спеціальну hash-функцію, котра дозволяє отримувати інформацію із найменшою кількістю дій над словничком (аналогія дії - перелистування сторінок словника, що є вкрай повільним). Hash-фунція на основі вхідної послідовності символів (текста чи слова) підраховує число. Якісна hash-функція буде генерувати числа особливим чином, якщо в тексті замінити бодай одну літеру число має змінитися кардинально, але визначальним є те що якщо на вхід подавати одну і ту ж саму послідовність число має залишитися незмінним. Таким чином після того як ваша послідовність символів потрапила у словничок, вам не потрібно гортати його сторінки для того щоб знайти необхідний ключ, ви підраховуєте хеш-функцію яка вам повертає номер сторінки де має знаходитись слово. Hash-функція отримала таку назву із-за дій що вона виконує над вхідними данними всередині себе. Фактично вона “кришить”, “рубає”, “перемішує”, “заплутує” вхідні данні, що відповідає англійському перекладу слова hash. Тобто логічним було б перекласти слово хеш у цьому контексті як “криш” або “міш”. Переклад слова “tag” вже здійснений, і це “мітка”, поєднавши ці варіанти отримаємо “кришмітка” що в одночас володіє певною милозвучністю.

“Кришітка” є спрощеним варіантом новотвору “кришмітка”, запропонованого Денисом Яремовим. Але має кілька суттєвих переваг: 1) Милозвучніше; 2) Відповідає етимології (криш-мітка); 3) І до того ж співзвучне з назвою самого символу # - “решітка”.

Знову захотілося писати Соломку українською мовою, просто щоб мати змогу використовувати слово “кришітка” :)


Removed the dependency from $SPRINT by simplifying basically everything in .zshrc:

s () {task s$(date +%-V) or sprint:c $*}

Downloading private youtube playlist using youtube-dl

A mostly-complete example: youtube-dl --yes-playlist --cookies ~/D/cookies.txt --playlist-end 100 --playlist-start 18 --write-description --write-info-json --all-subs -o '%(playlist_index)s - %(title)s.%(ext)s' --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.9.5 Chrome/56.0.2924.122 Safari/537.36" --min-sleep-interval 0 --max-sleep-interval 20 -i\?list\=$MYPLAYLIST

-i is for skipping errors (“ERROR: 1Jlvi4qTiyE: YouTube said: This video contains content from DisneyEnterprisesInc, who has blocked it on copyright grounds.”)

I could not get --user to work, because I got error 400, but --cookies works. qutebrowser’s cookies are not in the right format (but are located at ~/.local/share/qutebrowser/cookies and nicely readable), and firefox’s cookies can be downloaded using cookies.txt – Get this Extension for 🦊 Firefox (en-US).

Youtube mildly interesting statistics

Out of 2279 videos, 1995 were available, that would mean 87.5%. Makes me a bit anxious about the links on my links wiki :) I should do some datahoarding/archiving there too.

And another interesting thing - the random quotes from my file usually are not easy to google, and the only result is my blog post with them (Private: ~/notes/quotes; ~/notes/phrases | Я сам, соломка, чай.)

Everything as-is, sadly I don’t have sources for everything, but should be pretty easy to google.



kibble is store-bought dry (mostly) cat food. To kibble = ‘to coarsely grind’. Found on Peter Watts’ The Kibble Fund

Day 492

Searching in quotes

TIL DDG doesn’t allow me to search for exact matches in quotes, which I find absolutely idiotic. Yandex works, Google works. The usual “I want to like ddg but I honestly can’t”

To read / interesting

/g/ - Let’s collect here programming books that are unusual in some sense, be it their approach, presentation, or simply just quality. “The little schemer” has a nice dialog-like structure, and I find this very interesting. I wonder if there are any other similar books (or threads).

Editing bash scripts

Take care editing bash scripts

Well, after the 30 seconds elapses, the running script deletes all of my files. This happens because bash reads the content of the script in chunks as it executes, tracking where it’s up to with a byte offset. When I delete one character from the sleep line, the “next command” offset points at the r in #rm instead of the #. From the interpreter’s point of view, the # shifts backwards onto the previous line so it runs the unfortunate command.

javascript:(function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})(), found in One of my favorite bookmarklets to remove cookie notifications or other obnoxiou… | Hacker News

To run it as bookmarklet in qutebrowser, jseval works:

:jseval (function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})()

Now bound to ,b:

config.bind(",b", ":seval (function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})()")

And as a bonus, ,w now takes me to the wayback machine for that page:

config.bind(",w", ":jseval javascript:location.href='*/'+location.href")

Qutebrowser show all bindings

:bind opens a page with all the bindings as currently configured. This answered a lot of my quesions, especially about the caret mode bindings that are not documented anywhere I could find. What’s interesting is the Ctrl-e in Insert mode that opens the editor (I usually did Esc+e)

Day 489

Blog categories

TODO: Add links to categories in my blog, they might be useful for example for Pentachronological #0015 Праздник | Я сам, соломка, чай.. And in general maybe look into the blog itself - maybe I want to unite it with Diensttagebuch or something?

Jekyll images size



If you really want to make something good, eat good food and drink good saki. (Welcome to the NHK, episode 20.) 1

A tv drama has a progressive plot, an emotional climax and a resolution, but our lives aren’t like that… all we get day after day are vague anxieties that are never resolved. 2

questo è uno di quegli anime che fanno morire una piccola parte di te, passi 1-2 giorni ripensando a ciò che hai visto malinconico. Al 3 giorno pensi un’ultima volta a ciò che ti ha trasmesso, sorridi e il vuoto che ti ha dato si riempie di fiori dandoti molto di più da ciò che ti aspettavi. 3

And on the topic of fully enlightened people:

Ad-hoc tables via tabulate

tabulate works surprisingly well to make random tables:

>>> x = tabulate.tabulate([['WHAT','Will happen','Will not happen'],['If I do this','',''],['If I don\'t do this','','']],tablefmt='grid')
>>> print(x)
| WHAT               | Will happen | Will not happen |
| If I do this       |             |                 |
| If I don't do this |             |                 |


(wow?) debellare - Wiktionary - sconfiggere/eliminare. 3

Day 488

Inkscape make handler nodes bigger

microscopic handle nodes - Beyond the Basics - Inkscape Forum

Confusingly, that setting is in Preferences > Input/Output > Input Devices.

Krita lags

Krita’s slowness can be fixed by looking at the settings of Display and looking through Krita FAQ — Krita Manual version 4.3.0.

Day 486

Except by clicking on them, f gives numbers you can follow;F outputs the link text in the statusbar.


The Anki::Import documentation doesn’t make it clear enough, but using a quote(') works too for carrying on old tags along with the usual backtick, but for signalling an empty field only the backtick works.

Also I don’t think I can control the Cloze deletions - it automatically generates identifiers for them. Not going to get into perl to fix this :)

Vim regex reference

Vim Regular Expressions 101 is a really nice reference for vim’s search/replace/regex things. Maybe I’ll work through it later.

Most interesting is that groups are created with \(-\) and mentioned as \1 (will be handy for search-and-replace!)

I miss having a “now learning” textfile. (TODO)

Also this is a nice summary of the differences between vim and python/perl regexes, in vim characters are more likely to be literally interpreted: 1

Perl    Vim     Explanation
x?      x\=     Match 0 or 1 of x
x+      x\+     Match 1 or more of x
(xyz)   \(xyz\) Use brackets to group matches
x{n,m}  x\{n,m} Match n to m of x
x*?     x\{-}   Match 0 or 1 of x, non-greedy
x+?     x\{-1,} Match 1 or more of x, non-greedy
\b      \< \>   Word boundaries
$n      \n      Backreferences for previously grouped matches

And remains the best place to test usual regexes.

Pinta and gthumb

I’ve been looking for something simpler than GIMP for casual blurring / cropping / adding text, pinta mostly fits the bill but I find it hard to use and no easy blur brush, gthumb is much more minimalistic in functions but is more pleasant to use.

Zsh global aliases and aliases that take arguments

Zsh has global aliases! An Introduction to the Z Shell - Aliasing is awesome. alias -g M='| more' -> who M

This has a lot of potential for often-typed parts of commands.

But I went there to look for arguments, and apparently zsh explicitly doesn’t have them and wants functions instead. So:

% rm () { mv $* /tmp/wastebasket }
% rm foo.dvi
% ls /tmp/wastebasket

So I changed my taskwarrior s alias to:

#alias s='task s$SPRINT or sprint:c' 
s () {task s$SPRINT or sprint:c $*}

Now I can finally filter my tasks for the sprint (s +F)

// TODO replace dependence on $SPRINT by just usind current week number.

Not the first time I neglect to read the documentation of the software I switch to, being happy that it mostly works like the previous one.

Day 485

Random / interesting

The Technium: 68 Bits of Unsolicited Advice

My favourite parts:

  • Being enthusiastic is worth 25 IQ points.
  • Being able to listen well is a superpower. While listening to someone you love keep asking them “Is there more?”, until there is no more.
  • A worthy goal for a year is to learn enough about a subject so that you can’t believe how ignorant you were a year earlier.
  • Gratitude will unlock all other virtues and is something you can get better at.
  • Treating a person to a meal never fails, and is so easy to do. It’s powerful with old friends and a great way to make new friends.
  • Reading to your children regularly will bond you together and kickstart their imaginations.
  • Rule of 3 in conversation. To get to the real reason, ask a person to go deeper than what they just said. Then again, and once more. The third time’s answer is close to the truth.
    • Compare Five whys - Wikipedia* and death certificates with multiple “due to (or as a consequence of)”
  • The purpose of a habit is to remove that action from self-negotiation. You no longer expend energy deciding whether to do it. You just do it. Good habits can range from telling the truth, to flossing.
  • Promptness is a sign of respect.
  • If you are looking for something in your house, and you finally find it, when you’re done with it, don’t put it back where you found it. Put it back where you first looked for it.
  • Show up. Keep showing up. Somebody successful said: 99% of success is just showing up.
  • Separate the processes of creation from improving. You can’t write and edit, or sculpt and polish, or make and analyze at the same time. If you do, the editor stops the creator. While you invent, don’t select. While you sketch, don’t inspect. While you write the first draft, don’t reflect. At the start, the creator mind must be unleashed from judgement.
  • Perhaps the most counter-intuitive truth of the universe is that the more you give to others, the more you’ll get. Understanding this is the beginning of wisdom.
  • Friends are better than money. Almost anything money can do, friends can do better. In so many ways a friend with a boat is better than owning a boat.
  • You are what you do. Not what you say, not what you believe, not how you vote, but what you spend your time on.
  • When you die you take absolutely nothing with you except your reputation.
  • Before you are old, attend as many funerals as you can bear, and listen. Nobody talks about the departed’s achievements. The only thing people will remember is what kind of person you were while you were achieving.
  • When crisis and disaster strike, don’t waste them. No problems, no progress.
  • When you get an invitation to do something in the future, ask yourself: would you accept this if it was scheduled for tomorrow? Not too many promises will pass that immediacy filter.
  • Acquiring things will rarely bring you deep satisfaction. But acquiring experiences will.
  • Rule of 7 in research. You can find out anything if you are willing to go seven levels. If the first source you ask doesn’t know, ask them who you should ask next, and so on down the line. If you are willing to go to the 7th source, you’ll almost always get your answer.
  • When someone is nasty, rude, hateful, or mean with you, pretend they have a disease. That makes it easier to have empathy toward them which can soften the conflict.
  • Eliminating clutter makes room for your true treasures.
  • Experience is overrated. When hiring, hire for aptitude, train for skills. Most really amazing or great things are done by people doing them for the first time.
  • Buying tools: Start by buying the absolute cheapest tools you can find. Upgrade the ones you use a lot. If you wind up using some tool for a job, buy the very best you can afford.
  • Following your bliss is a recipe for paralysis if you don’t know what you are passionate about. A better motto for most youth is “master something, anything”. Through mastery of one thing, you can drift towards extensions of that mastery that bring you more joy, and eventually discover where your bliss is.
  • The universe is conspiring behind your back to make you a success. This will be much easier to do if you embrace this pronoia.

Backup entire github account with all the repositories

Very nice tool: amitsaha/gitbackup: Tool to backup your GitHub and GitLab repositories

The Github token needed only the repo scope, needed to add it to the env variable with:


Command to backup was:

./gitbackup-0.5-linux-amd64 -backupdir $BACKUPDIR -service github

Should also work for gitlab.

Also magically it took something like 30 seconds for the all of the 3.5GB of all my repos.

Day 484


lutschen / an etwDat. lutschen - to suck (on) sth; Lutschtablette = lozenge.


lozenge: 1) A rhombus (shape); 2) A small (originall diamond-shaped!) tablet/sweet for a sore throat.

Random / interesting

Agnes Obel - Fuel To Fire (Official Video) - YouTube

First comment on the video:

All the people in this video are dead. Life is short, don’t do anything that makes you unhappy

Day 481

History is happening

We live in interesting times.


shambolic - Chaotic, disorganised or mismanaged. Found somewhere on The Guardian applied to Trump’s daily health briefings.


– layout: post title: “Day 479” date: 2020-04-23 12:19:17 +0100 categories: [] —

Vim exclamation mark to switch parameters

A ! either forces the action or toggles the action:

:set cursorline, to turn off: :set nocursorline

Is equivalent to:

:set cursorline! 1

python tabulate module

tabulate2 generates nice tables of various formats! Things like:


      epoch    loss    val_loss    val f-score
--  -------  ------  ----------  -------------
 0        1    4.31        4.62          0.579
 1        2    3.72        3.61          0.705
 2        3    3.54        3.25          0.722
 3        4    3.31        3.06          0.737
 4        5    3.19        2.93          0.736
 5        1    4.31        4.62          0.581
 6        2    3.72        3.61          0.72
 7        3    3.54        3.25          0.755
 8        4    3.31        3.06          0.755
 9        5    3.19        2.93          0.764
10        6    3.12        2.83          0.798
11        7    2.95        2.76          0.779
12        8    2.91        2.69          0.757
13        9    2.84        2.64          0.816
14       10    2.68        2.63          0.835
15       11    2.71        2.56          0.83
16       12    2.69        2.52          0.825
17       13    2.62        2.49          0.826
18       14    2.6         2.46          0.845
19       15    2.56        2.44          0.84

tabulate · PyPI is the basic documentation with visualizations of each tablefmt. It even supports jira! And pipe is the usual markdown format. Let’s try:

  epoch loss val_loss val f-score
0 1 4.31 4.62 0.579
1 2 3.72 3.61 0.705
2 3 3.54 3.25 0.722
3 4 3.31 3.06 0.737
4 5 3.19 2.93 0.736
5 1 4.31 4.62 0.581
6 2 3.72 3.61 0.72
7 3 3.54 3.25 0.755
8 4 3.31 3.06 0.755
9 5 3.19 2.93 0.764
10 6 3.12 2.83 0.798
11 7 2.95 2.76 0.779
12 8 2.91 2.69 0.757
13 9 2.84 2.64 0.816
14 10 2.68 2.63 0.835
15 11 2.71 2.56 0.83
16 12 2.69 2.52 0.825
17 13 2.62 2.49 0.826
18 14 2.6 2.46 0.845
19 15 2.56 2.44 0.84

Tensorflow how does training happen with nan? TODO

How does Tensorflow train stuff when loss is nan? It keeps doing something, accuracy changes, etc etc etc. - is the gradient calculated per batch as normal,


Einstein / Netzah “do your own thing”

Day 478


Zinseszins - Wiktionary - compound interest. Beyond logic

pandas / python split string by multiple delimiters

Split string with multiple delimiters in Python - Stack Overflow has this really nice idea of doing str.replace(':', '_') and then str.split('_').

Pandas split string to different columns

Series.str.split(delim) can do Series.str.split(delim, expand=True), that returns different columns instead of a list.

Also - if graphs don’t make sense, one way things have gone wrong is interpreting x and y as strings.

Day 476

Qutebrowser open in new background tab

c.tabs.background = True in config opens new tabs in the background when middle-clicking.

History is happening

Nurse blocking anti lockdown protests in Denver : PublicFreakout and the imgur album: Health care workers stand in the street in counter-protest to hundreds of people who gathered at the State Capitol to demand the stay-at-home order be lifted in Denver, Colo., on Sunday, April 19, 2020. Photos by Alyson McClaran - Album on Imgur. As someone said, I really imagine seeing this in history books.

Screen logging

To visualize logs of screen sessions, less -r filename (-R hates ^H progress bars but I search seems to work a bit better) works very well. Even for the (tf) progress bars almost. ansifilter exists but deals with progress bars much worse.

Empirically - for searching and scrolling the same font size / terminal size is very helpful.

Vim macros posting

Just pasting the Vim macro on Day 469, while it did not break Jekyll this time (why?), seems to have broken the RSS script at the beginning of the page.

This page contains the following errors:

error on line 19 at column 73: PCDATA invalid Char value 27

Copypasted the lines from terminal and back, but I need a much better way to save and ‘publish’ the macros. Found Vim Macro Trickz • Hillel Wayne when looking for solutions.

German grammar

  • You need a dot between things like ‘u. a.’ in German, apparently.
  • on a noisy dataset = auf ein Verrauschtes Dataset
  • Dataset = der Datensatz, learned this far too late :)

Essential oils

.. can be added in a bath, but only in a carrier oil, olive oil works.

“For a single bath, three to 12 drops of essential oil in a tablespoon (15 ml) of carrier oil is sufficient to create a very aromatic, therapeutic bath” 1

Day 473

Tensorflow Tensorboard download CSV

Can I export a tensorflow summary to CSV? - Stack Overflow – yes I can, by clicking “show data download links” on the top left of interface and selecting what I want to download below the plots.

Why does loss increase at the beginning of an epoch?

machine learning - Why training loss is increased at the beginning of each epoch? - Stack Overflow - probably because the dataset is not random enough, and the network overfits on the structure of the dataset. Happens with buffer_size dramatically less then the size of the structured dataset.

Day 469


Added config.bind('tw', 'set-cmd-text -s :open -w') to config, now tw is like a, but for windows instead of tabs.

Vim markdown references macro

Added this macro: let @R = 'viw"oyi[^^[^[^[^[A]^[^[^[Go[^^[^[^[^["opA]: ^[^[^[^['

When the last word in the line is selected, it gets transformed immediately to a reference. I’ll use this vim cheatsheet as 1.

As a bonus, this uses a non-default vim register so whatever is in my clipboard stays there. (But it destroys whatever I had in "o).

Day 467

History is happening

Mafia distributes food to Italy’s struggling residents

In recent days, the police in Naples have intensified their presence in the poorest quarters of the city, where men tied to the Camorra, the Neapolitan mafia, have organised home delivery of food parcels. Magistrates have already begun an investigation against a group of people who were questioned while distributing food to local residents.

Greater Good podcast

The Science of Happiness | Greater Good is a podcast about happiness, found it while looking for The Happiness Lab which is also a podcast about happiness.

Day 465

Vim custom syntax highlighting

For SIOM and my morning pages the following two commands highlight in yellow all lines starting with a “+” after zero or more of any kind of space:

:syntax match mys /^\s*+.*$/
:highlight link mys Keyword

To do this everytime I open a markdown file:

fun! SetQuestions()
    syn match mys /^\s*+.*$/
    hi link mys Keyword
autocmd filetype markdown :call SetQuestions()

Python stalinsort testcases

Never thought about it like this, but for simple algorithms the test cases can be put in a nice array and iterated through: stalin-sort/ at master · gustavo-depaula/stalin-sort

# pairs of input - output
test_cases = [([1, 2, 3, 4, 5], [1, 2, 3, 4, 5]), # sorted list
              ([5, 4, 3, 2, 1], [5]), # reversed list
# test sort_fun on all test cases defined above.
def test_all(sort_fun):
  for xs, expected in test_cases:
    print(f'testing with input {xs}, expecting output {expected}.')
    result = sort_fun(xs)
    print(f'output was {result}')
    assert(result == expected)


  • Watched Southern Comfort, 7/10, expected more based on the one clip with the song, but no regrets
  • Drew a couple of things, TODO later paste here :)

Day 464

screen naming screens

Screens named with screen -S myname and attached by screen -r myname - tab completion works with screen -r!

Taskwarrior list unfinished tasks created more than 2 weeks ago

entry is the time the task was created. So:

task all sprint:$SPRINT status:pending entry.before:eow-3wk tags.not:s,end,tags,description,Done,Tags,Description rc.verbose:label,blank is what I’ll use in SIOM.

Google calendar has shortcuts!

I missed this all my life.

  • j/k work predictably.
  • t Today
  • g Go to date
  • c create

Tensorflow GPU use

If more than 1 GPU are visible, tensorflow will take some memory on all of them, even if its actively using only one. Restricting visibility the usual way helps.

Day 463

taskwarrior better ‘done / completed last week’ command filter

task all status:completed end.after:eow-2wk – I forgot you could do almost-math with the datetimes!

Editing the output, to sort it by project, divide different ones by newlines, and show the headers of the table but nothing else: task all status:completed end.after:eow-2wk,entry,end,tags,description,Created,Finished,Tags,Description,end rc.verbose:label

Day 462

How to make perfect italian pizza

This is a really nice video: How to Make Perfect Pizza | Gennaro Contaldo - YouTube

Qutebrowser mediawiki yank userscript

Using an userscript for this is overkill, but ``` #!/usr/bin/python3 import os title = os.environ['QUTE_TITLE'] url = os.environ['QUTE_URL'] with open(os.environ['QUTE_FIFO'], 'w') as f: f.write("yank inline \"[{} {}]\"".format(url, title)) ``` Located at `/home/shamotskyi/.local/share/qutebrowser/userscripts/`. In the config, `config.bind('yw', 'spawn --userscript')`

EDIT: replaced this with config.bind('yw', 'yank inline "[{url} {title}]"').

Taskwarrior tasks completed today

I have not been using it to the fullest.

List tasks completed today: task all status:completed end:today This might be something I can copypaste into my pages or in my reports, such as my weekly sprint review! Adding it as a module to siom should be not too hard. Taskwarrior - Usage Examples contains more nice examples.

Python3 glob

glob is not sorted! glob.glob().sorted() though is.


kitty - the fast, featureful, GPU based terminal emulator — kitty 0.17.2 documentation: ctrl+shift+s is paste from selection ctrl+shift+u for unicode characters

Set default browser from the shell

sudo update-alternatives --config x-www-browser

Doesn’t seem to work for kitty, but in the config open_url_with qutebrowser works predictably.


gratuitous - Wiktionary - given freely, unearned; without reason, unjustified, unnecessary, uncalled for. Seen first in Behemoth by Peter Watts.

Taskwarrior / zsh / … week number

For the sake of consistency (to each other and especially to Google Calendar) now my sprint number and week number is the ISO week number: export SPRINT=$(date +%-V)

Fixed this in:

  • $SPRINT environment variable
  • weekNumberValue in siom
  • i3 statusline:
    tztime local {
          format = "[%V] %a %Y-%m-%d %H:%M:%S"

Only place it’s left now is in my paper calendar, but I don’t use it too much these days.

Day 460


balmy - Wiktionary - soothing, fragrant, mild, pleasant. Found in Behemoth by Peter Watts.

Vim modeline

I should check vim modelines (Vim documentation: options) out, systematically.



Try adding cauliflower in my pasta water 1

And pasting my favourite Reddit comment for posterity:

[deleted] 385 points · 1 year ago · edited 1 year ago

This isn’t wrong, but not the tradition Italian way. The way we do it in Italy (Sicily) is to split the sauce in half. Take the pasta out about a minute or less before al dente. If you’re going for the creamy flavor, sauce permitting, mix some butter with the pasta as you’re draining the water. Then put the pasta in the sauce pan with half of the sauce and a (tiny) bit of pasta water. 1/4 of a cup is too much in our opinion because you don’t want to cook the pasta in the sauce for too long. Use the other half of the sauce to top it off. That’s not to say this is the only way Italians do it, but my Southern Italian family has been using this method for generations. I’m not a fan of OP’s method, if you want this kind of pasta just make a cacio e pepe.

On a separate but related note, tomato sauces (without meat) should only be cooked for 30 minutes, after that they lose the aroma. Of course I’m biased, but a simple tomato sauce is one of the easiest and most delicious things in the world to make. Simmer garlic until sizzling (add red pepper flakes with garlic for arrabbiata) add decent plum tomatoes (buy whole ones and hand crush them) with S&P, basil, oregano. You can add some butter if you like. Stir occasionally, 30 minutes later you’re done.

Edit: I always used to laugh to myself when I saw people getting excited about getting their first gold, and now I’m that person. Thanks kind stranger. 2


You can freeze bread without problems:

He starts with what not to freeze: “I never recommend freezing things like baguettes or ciabatta. Anything that has a large surface-to-crumb ratio just never refreshes the same.” 3

If baking, let your bread cool completely. This will prevent it from becoming soggy or moldy. Wrap each loaf tightly in plastic wrap. Then wrap it in foil or freezer paper. The double-wrap is your secret weapon for freshness.4

Unfreezing works overnight in the refrigerator. 4

While I’m at it, the yeast ratio is 2 1/4 teaspoons dry active, instant, or rapid-rise yeast granules (usually one 1/4-ounce packet) = 2/3 ounce fresh yeast 5


If I do annotations / sources / references, I have to put the definition on a new ‘new’ line, so it’s a new block. This was my error back at the very beginning. Not one but two.


Vim macro to create an reference based on a selected line.

Day 456

Python -v

So apparently python -v exists, output includes the adresses of all loaded modules

Day 455

Qutebrowser edit url in editor

config.bind('E', 'set-cmd-text -s :edit-url') added to allows me to press E and the command will be prefilled.

Interesting arguments 1:

-b, --bg: Open in a new background tab.
-t, --tab: Open in a new tab.
-w, --window: Open in a new window.
-p, --private: Open a new window in private browsing mode.

Keyboard layout changes

Made the following changes and bumped the version to v5:

// Changing aoeu for umlauted letters

    key <AC01> { [	    a,	A, adiaeresis,	s]	};
    key <AC02> { [	    o,	O, odiaeresis,	n]	};
    key <AC03> { [	    e,	E, ediaeresis,	t]	};
    key <AC04> { [	    u,	U, udiaeresis,	u]	};

// Adding ~` to the better key for this

    key <AD01> { [  apostrophe,	quotedbl,	grave,	asciitilde] };
    key <AD02> { [	comma,	less,   r, asciitilde] };
// Adding parentheses in a better place

    key <AD08> { [	    c,	C,	Up,	 parenleft	]	};
    key <AD09> { [	    r,	R,	BackSpace,	parenright		]	};

    key <AD07> { [	    g,	G,	bracketleft,	braceleft		]	};
    key <AD10> { [	    l,	L,	bracketright,	braceright]	};

// Numbers!

    key <AB01> { [   semicolon,	colon,1,	exclam] };
    key <AB02> { [	    q,	Q,	2,	at		]	};
    key <AB03> { [	    j,	J,	3,	numbersign		]	};
    key <AB04> { [	    k,	K,	4,	dollar		]	};
    key <AB05> { [	    x,	X,	5,	percent		]	};
    key <AB06> { [	    b,	B,	6,	asciicircum]	};
    key <AB07> { [	    m,	M,	7,	ampersand]	};
    key <AB08> { [	    w,	W,	8,	asterisk]	};
    key <AB09> { [	    v,	V,	9,	asterisk]	};
    key <AB10> { [	    z,	Z,	0,	asterisk]	};

// A new delete key
    key <AC06> { [	    d,	D,	KP_Delete,	asterisk]	};

Now I have brackets on my right hand letters :) I’ll think later what other symbols I still have not learned by heart and move the below. (Numbers, maybe?)

Fiamma userscript update

Updated the userscript to the following, now it removes stuff Mediawiki doesn’t like from the name of the page (but not from the Title, which is not part of the URL!)

import os
from urllib.parse import quote_plus

def urlencode(string):
  return quote_plus(string)

def replace(original):
    new = original.replace("|", "-")
    return new

def replace_name(original):
    new = original.replace("|", "-")
    new = new.replace("[", "(")
    new = new.replace("]", ")")
    new = new.replace("#", "(hash)")
    new = new.replace("{", "(")
    new = new.replace("}", ")")
    new = new.replace("_", " ") # TODO test
    return new

title = os.environ['QUTE_TITLE']
url = os.environ['QUTE_URL']
selected_text = os.environ['QUTE_SELECTED_TEXT']

newTitle = replace(title)
newArticleName = replace_name(title)
newUrl = replace(url)
newText = replace(selected_text)

article_title = urlencode(newTitle)
article_name = urlencode(newArticleName)
page_url = urlencode(newUrl)
selected_text = urlencode(newText)

fiammaUrl = ''
url = fiammaUrl+'?title='+article_name+'&action=edit&preload=Template:NewLink&preloadparams[]='+page_url+'&preloadparams[]='+article_title+'&preloadparams[]='+selected_text

with open(os.environ['QUTE_FIFO'], 'w') as f:
    f.write("open -w {}".format(url))

Random / Interesting

This is a nice wikipedia page that starts with “Q.” and not with “Q:”, because “Q:” is forbidden as start of page name: Q. Are We Not Men? A: We Are Devo! - Wikipedia

Pizza dough

I’ll try to do this tomorrow: The Best Pizza Dough Recipe - Sugar Spun Run

Mattermost and Python

For when I get to this, it’s easy, after I install matterhook:

>>> mwh = Webhook('', 'myAPIhook')
>>> mwh.send('test',channel='notif')

Very nice explanation here: GitHub - numberly/matterhook: Interact with Mattermost incoming webhooks easily.

Python run from command line / shell with all the imports and stuff

Say I’m in folder2 and want to run folder2/folder/

python3 -m folder.main adds folder2 to $PATH, while python3 folder/ adds folder to $PATH. The first option makes all imports much much easier.

Day 453

Giving names to screen sessions

To set a name to a screen session to make attaching it easier, you either set it as parameter during screen creation (screen -S screenname) or set it from inside an attached screen by typing <C-a> :sessionname screenname. It will look like that:

There are several suitable screens on:
	74720.trying_to_run_GPU	(03/28/20 00:33:28)	(Attached)
	70666.whatisthis	(03/28/20 00:20:53)	(Detached)

(Setting a name for a screen session - Unix & Linux Stack Exchange)

To attach it I can use only its name: screen -raAd whatisthis

TODO actually read the man pages and have a better understanding of these flags instead of treating them like incantations.

watch command set interval and highlight changes

This is nice! To watch a file grow in size, except watch ls -lar you can do watch -d -n 1 ls -lar. -d makes it highlight the differences, and -n for some reason is the interval. (-i was taken I guess).

Use only one GPU for training in Tensorflow

I keep googling this, so: export CUDA_VISIBLE_DEVICES=2

And to set an environment variable before running the script (in bash at least) it’s TEST=foo; echo $TEST (shell - How do I set an environment variable on the command line and have it appear in commands? - Unix & Linux Stack Exchange). export is just to make it available for other commands.


It’s quite cute how google interprets me looking for kitty paths linux as cat paths linux, as in I believe that they are kinda similar in many contexts.

That said, it’s very refreshing to see a program where reading the config file documentation on its official website doubles as basic tutorial for the program, since all the keyboard shortcuts used in the example config are the real ones.

Tensorboard & SSH tunnelling

Not sure why this surprises me, but I can first start a SSH shell that does a tunnel (.. and opens a SSH shell), then from it start the thing on the port that I am tunnelling. This almost looks like something I could automate if I do it often enough.


ferine - Wiktionary - “pertaining to wild, menacing animals” - same in Italian. First seen here: Ninco Nanco - Wikipedia.


speiseöl | Übersetzung Englisch-Deutsch is basically any cooking oil.

Book about baking bread

If you want to learn more about the process and jump off the deep end, Peter Reinhart’s book “The Bread Baker’s Apprentice” is a great place to start. It is detailed without being pedantic, simple without being over-simplified, and oriented for the home baker without forgetting the reasons that professionals do things the way they do.

Why do you need to refrigerate bread dough overnight? - Seasoned Advice

Day 452


  • papierdeutsch – Wiktionary - in trockener, komplizierter deutscher Sprache; im Papierdeutsch. Found when looking for a synonim for ‘baldigst’
  • abwertend – Wiktionary - opposite of ‘lobend’/’positiv’. Found it as description of ‘papierdeutsch’ :)

Day 451

History is happening

Hilariously aggressive Covid-19 propaganda banners in China - SupChina

Not gathering for a feast is so you can eat in the future, Not visiting others is so you still have relatives in the future

Everyone you encounter on the streets now is a wild ghost seeking to take your life

Stay in and don’t wander around, You have AC, television, and wifi as your friends

Kitty zoom (=change font size)

To zoom in/out in Kitty:

map ctrl+shift+equal change_font_size all +1.0
map ctrl+shift+minus change_font_size all -1.0

Fiamma qutebrowser userscript

Edited the userscript to pass selected text as a third parameter to the NewLink template, to which I added the third parameter, and removed the automatic closing of the window from the vim macro.

i3 keybindings to move to / select a screen / output

# focus outputs
bindsym $ms+o focus output DP-1-1
bindsym $ms+e focus output HDMI-2
bindsym $ms+u focus output eDP-1

Disable GPU in Tensorflow via environment variable

How to disable GPU with TensorFlow? - Data Science Stack Exchange

import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"

.. or set it from outside the script.

tf.shape(x) vs x.shape 1 hour 58 minutes of debugging if it’s inside of a It seems to return None inside .map(), and None==1 is False instead of an exception.

Day 450

Kitty - the terminal emulator

Added bindsym $ms+Return exec ~/.local/ to ~/.config/i3/config kitty - the fast, featureful, GPU based terminal emulator — kitty 0.17.1 documentation is really awesome actually, and noticeably faster than any other terminals I’ve used.

TODO - read through the documentation linked above, esp wrt zooming and config.

<Ctrl+Shift+F2> opens the config file. In general I love everything about Kitti for now, in all the tiny little details.


font_family      FiraCode-Bold
font_size 10.0
cursor_blink_interval 0.5
scrollback_lines 5000
strip_trailing_spaces smart

background_image ~/test.png
background_image_layout tiled
background_tint 0.7

Random / interesting

Waffle House Index - Wikipedia

If you get there and the Waffle House is closed? That’s really bad… — Craig Fugate, Former Head of the Federal Emergency Management Agency

Qutebrowser writing python userscripts

Just wrote this and put it into ~/.local/share/qutebrowser/userscripts/

This is an userscript that allows me to escape my only problematic markdown character (|) when copying with ym:

import os

title = os.environ['QUTE_TITLE']
title = title.replace("|", "\\|")

url = os.environ['QUTE_URL']

with open(os.environ['QUTE_FIFO'], 'w') as f:
    f.write("yank inline \"[{}]({})\"".format(title, url))

Added config.bind('ym', 'spawn --userscript') to

Python set environment variables

Why did I need to use with open(..) as f: in the above script and couldn’t just do os.environ['sth']='sth else'?

Taskwarrior task annotation

It took seeing qutebrowser/taskadd at master · qutebrowser/qutebrowser to learn that you can annotate tasks in taskwarrior! task 123 annotate my annotation that can be long adds a visible line with the annotation under the task that is shown whenever the task is shown. This is awesome and I should read manpages sometimes.

Keyboard layout

I should finally put it in order, especially given that I mostly don’t use the left-hand part of the left-hand typing layout, I started today by putting my ` and ~ no LALT+SHIFT+apostrophe by adding this:

key <AD01> { [ apostrophe,!quotedbl, grave, asciitilde] };

to /usr/share/X11/xkb/symbols/v4

Making Fiamma / Semantic Mediawiki alive again

{{=}} template

Using Template:= - Wikipedia as an example, I created a page located at = - Fiamma which I can include as {{=}} to replace URIs in parameters in my Template:B - Fiamma template. I’m not sure how would I edit all pages containing equal signs in parameters but this is a nice start. My source is Help:Template - Wikipedia, first bullet point.

Same works for |, for which there’s already the default template {{!}}.

New javascript bookmarklets qutebrowser userscripts!

The old venerable bookmarklets I wrote about here Updated Fiamma “Add link” bookmarklet (now there are two of them!) | Я сам, соломка, чай. are as dead as it gets, I’ll write one userscript to rule them all :) Or one userscript and one vim script to expand it.

Current iteration is:

import os
from urllib.parse import quote_plus

def urlencode(string):
  return quote_plus(string)

def replace(original):
    new = original.replace("|", "-")
    return new

title = os.environ['QUTE_TITLE']
url = os.environ['QUTE_URL']

newTitle = replace(title)
newUrl = replace(url)

et = urlencode(newTitle)
eu = urlencode(newUrl)

fiammaUrl = ''
url = fiammaUrl+'?title='+et+'&action=edit&preload=Template:NewLink&preloadparams[]='+eu+'&preloadparams[]='+et

with open(os.environ['QUTE_FIFO'], 'w') as f:
    f.write("open -w {}".format(url))

Pages to test this on:

Running userscript in qutebrowser

I had issues with commands executing too early, for example before the previous one has executed. So:

config.bind('B', 'spawn --userscript')
config.bind('T', 'hint inputs --first;; later 20 leave-mode;; later 20 open-editor')

Lastly for some reason the “later” sometimes are interpreted as starting at the same time, not from the time the last command finished executing.

Vim macros for the vimwin


" let @H = 'gg??c??bi??c??b{{B|^[^[^[j0i|^[^[^[ji|j?kb^[^[^[ji|^[^[^[o}};q' " For the 5 lines
" let @L = 'ji{{$?kb%?kb#set:\^Mk=?kD^[o|+sep=,}}^[' " For the tags
" let @C = 'i[[C;tj?kb?kb?kbategory: ^[^[^[A]];q' " For each individual category 
" let @F = 'jjVG:norm! @C\^M' "Apply that to all lines till the end
" let @d = '@H@L@F'
" let @q = '^[A^[bbbbbbi|??^B?kb^[:%s/=/{{=}}/ge^M'

" Summed up:
let @C = 'i[[C;tj?kb?kb?kbategory: ^[^[^[A]];q' " For each individual category
let @H = '^[A^[bbbbbbi|??^B?kb^[:%s/=/{{=}}/ge^Mgg??c??bi??c??b{{B|^[^[^[j0i|^[^[^[ji|j?kb^[^[^[ji|^[^[^[o}};qji{{$?kb%?kb#set:^Mk=?kD^[o|+sep=,}}^[jjVG:norm! @C^M:x^M'
" let @d = '@H@L@F'

The above changes text like:
Diensttagebuch - A purely technical blog about things I did on particular days, for future reference and search.

tag1, tag tag2, tag3

And a category with space


|Diensttagebuch - A purely technical blog about things I did on particular days, for future reference and search.
k=tag1, tag tag2, tag3
|+sep=, }}

[[Category: Cat1]]
[[Category: Cat2]]
[[Category: And a category with space]]

For the above, jekyll had issues with utf-8 encoding and the escaped characters, so I copy-pasted them with my mouse from my terminal.

Additionally it converts the equal sign to its template, and saves-and-closes gvim.

… And with the glorious new page Waffle House Index - Wikipedia - Fiamma a new era for that wiki starts again!

This raises the question about what is the role of this blog, but I think here we’ll stick to IT stuff

Vim script omit “Pattern not found” error

..especially when writing macros that replace stuff. The magic is the e option at the end:


And the vim macro / script doesn’t break anymore.

DTB Master file

Added some things to the script, it’s even more ugly now but the resulting page is okay:

echo "Concatting all existing days"
cd _posts
echo \
layout: page
title: Master file
permalink: /master/
> ../

cat * | grep -v "layout: post" | grep -v "categories: \[" | grep -v "title:  \"Day" | grep -v "date:   20" | grep -v "\-\-\-"  >> ../

Day 449

Random / Interesting

Why do color TVs make black and white snow? | Hacker News

The other question is “why don’t you see that noise when the TV is tuned in?” The TV has automatic gain control. When the signal is weak, it will amplify it up to the right level. If the signal is just background noise, then it will amplify that background noise until it’s at the “right level” for a proper TV signal. So, the gain is lower for stronger signals, and very high when there is no signal at all.

the artefacts created in the black and white picture by the colour signal are hardly noticeable, but they are enough to recover the colour from a black and white recording! The Unofficial Colour Recovery Wiki | Fandom

Programmer competency matrix

Programmer Competency Matrix – Sijin Joseph, I don’t agree with everything but looks like a nice blueprint



Picture from xkcd what-if 0034 found on this article about evaluating LMs: Evaluation Metrics for Language Modeling and hotlinked from what-if 0034.


Added to

c.tabs.pinned.frozen = False
c.tabs.title.format_pinned = "{current_title}"

German / Deutsch

Cabinfever is der Lagerkoller.

Day 448

Bash print full path to a file

I’m so glad this exists and I don’t have to do pwd+ls+copypaste anymore!

# realpath example.txt

Not a default shell built-in, readlink -e (or -m or -f) does the same.

(shell - bash/fish command to print absolute path to a file - Stack Overflow)


Moses was fond of repeating at this time a quote often used in Albany. “You can get an awful lot of good done in the world if you’re willing to let someone else take the credit for it.” (The power broker by Robert A. Caro, p.315)

xclip using it right

Copy and paste at the Linux command line with xclip |

The line is yourcommand | xclip -sel clip which is aliased to xc, so yourcommand | xc.

scp port forwarding

If I have something running on servername:6006 reachable only from (on the server itself), I can do this: ssh -L 4000: servername

Which makes it available for me from my localhost as

To check if the thing running on servername can be reached from outside, netstat -tulpen

A Guide to SSH Port Forwarding/Tunnelling - Boolean World

qutebrowser tabs width

Added this to qutebrowser’s, two keybindings to make the tabs width smaller and back, to save screen space.

config.bind('<Ctrl-L>', 'set tabs.width 10%;; set tabs.favicons.scale 0.8;; set tabs.indicator.width 0;;set tabs.title.format {index}:{current_title}')
config.bind('<Ctrl-R>', 'set tabs.width 20%;; set tabs.favicons.scale 1;; set tabs.indicator.width 2;;set tabs.title.format {audio}{index}: {current_title}')


tetchy - “Easily annoyed or irritated; peevish, testy or irascible.”


Lost in Larrimah - Whooshkaa has 6 episodes 20 mins each and it sounds interesting.

Python formatting

PyFormat: Using % and .format() for great good! is a website dedicated completely to Python formatting that I could read through someday.

History is happening

Tutto bene (from Coronavirus: Italy bans any movement inside country as toll nears 5,500 | World news | The Guardian)

Day 446

History is happening

My favourite corona-Dashboard has a nice new option to “align by date of 100th case”: Coronavirus charts

It looks like this today:

Corona Dashboard

Day 445


The Mad Hatter in Alice im Wunderland in German is Der Hutmacher!

Mediawiki + SMW update

This was so so so easy, oh my God. Even though I was updating basically everything from a very old version, to a different PHP and MariaDB version.

TL;DR move files, install manually my one extension needed, export/import mysql table data, point the wiki to the newly created table/db, run php maintenance/update.php and it just magically took care of everything. Only gotcha was that I forgot the db prefix, which gave me DBQueryError after restore; error in update.php on Project:Support desk, solved with the first google result. This was so much easier than expected.

EDIT2 - forgot about Extension:ParserFunctions - MediaWiki, and a couple of smaller ones. So:

# End of automatically generated settings.
# Add more configuration options below.

wfLoadExtension( 'ParserFunctions' );


EDIT3: Had to move the /images/ folder with its content. To check for them, Gallery of new files - Fiamma works

Now live again at

EDIT4: properties seem to be broken and capitalized, which makes semantic search unusable. I’ll deal with it later.

Jonatan Hui blog

Jonathan Hui blog Mostly ML stuff in a static html blog.

zsh setting and checking environment variables

If I do: export PYTHON_PATH=$(pwd), then check it via $PYTHON_PATH hoping to see something like:\ zsh: command not found: Fr 20. Mär 19:48:01 CET 2020 - this won’t happen, as this is a path, and the result would be same as cd $PYTHONPATH, therefore outputting nothing and leaving me with the impression that the value was not being set.

Day 444

Changed font in the Terminal

Changed the font from Fira Code Light to Fira Code Medium (EDIT: now Bold. True-bold text still gets rendered as extra-bold, which is very nice too!). It works much better on not-bright-enough screens that stand in front of too-bright windows.

Tensorflow saving model weird errors about init things

I could not save a Tensorflow Keras model, the issue was that I passed arguments from init as: self.whatever = whatever, then changed self.whatever to a different data type (string to b’ytes’ w/ .encode in my case), then in the get_config() function then I happily said {'whatever': self.whatever,} which then could not be encode()‘d.

Random / interesting

Granular convection - Wikipedia is the process where biggerr parts of something float above when surrounded by smaller parts of something and vibration.

History is happening

I’m not sure this is the place for this (oh wait, my blog, I decide the rules, it is now), but since the universe is interesting right now, I feel like preserving some parts. Not necessarily like a diary, just links that I feel will represent this interesting time better than many words could.

Day 443

Githubusing keys instead of passphrase

This is very nice and concise: Setup SSH keys for use with GitHub/GitLab/BitBucket etc, along with this series: Generating a new SSH key and adding it to the ssh-agent - GitHub Help

TL;DR generate a key, add it to Github, add it to the ssh-agent as

$ eval "$(ssh-agent -s)"
> Agent pid 59566
$ ssh-add ~/.ssh/id_rsa

Test the results as

→ ssh -T                     
Hi username! You've successfully authenticated, but GitHub does not provide shell access.

If the key is in a non-default location, Host HostName User jaeaess IdentityFile ~/.ssh/id_rsa_github_jaeaess is needed in the ~/.ssh/config file.

To push without being asked for passwords, the remote needs to be changed from HTTPS to SSH:

$ git remote remove origin
$ git remote add origin

Since it doesn’t seem to be persistent, the unsafe way (even though it’s considered unsafe in general) is to add ssh-add -q ~/.ssh/id_rsa_github to startup.

Intellij Idea copy absolute path

To copy absolute path of a file, Ctrl+Shift+C works.

Transformer Keras load a trained model and do some changes

Very interesting discussion: Loading a trained model, popping the last two layers, and then saving it · Issue #8772 · keras-team/keras

For the Sequential model, model.pop() also exists but not for the Functional one.

For a Functional model, after getting a model from an .h5 file, we can do things such as: new_model = Model(model.inputs, model.layers[-3].output)

Day 442

Keras / Tensorflow why saving a subclassed model is hard

Very nice R-centric explanation, but should be valid for Python too: Saving and serializing models

A subclassed model differs in that it’s not a data structure, it’s a piece of code. The architecture of the model is defined via the body of the call method. This means that the architecture of the model cannot be safely serialized. To load a model, you’ll need to have access to the code that created it (the code of the model subclass). Alternatively, you could be serializing this code as bytecode (e.g. via pickling), but that’s unsafe and generally not portable.

TODO Tensorflow model saving / prediction

Why am I getting wildly different accuracies and losses after loading the model from .h5 file, when model.weights for both are identical and predictions (using model.predict()) too? This probably has something to do with me misunderstanding datasets, how exactly?


Day 441

Qutebrowser tab-give keybinding

Added config.bind('tg', 'set-cmd-text -s :tab-give') to qutebrowser set-cmd-text is nice, -s means add space to the end, and now I know more about qutebrowser modes in general - for example, I can do keybindings even while I’m inserting a :command. The further it goes the more I love qutebrowser.

Intellij idea debugger

Debug tool window - Help | IntelliJ IDEA

If I click and the Debugger pane disappears, Alt+5 makes it appear again in the previous state.

cat compressed files with zcat

This is very nice: zcat auth.log.3.gz

Choose default webcam

lenovo - 18.10: how to set system default webcam? - Ask Ubuntu

mv /dev/video0 /dev/video0.original
ln -s /dev/video2 /dev/video0

Day 437


How to Make Yourself Into a Learning Machine - Superorganizers - fascinating practical use of the Zettelkasten method, amongst other things - don’t have time for this now but I will read it later. + Using Anki to Remember Everything You Read | Hacker News as my source.

Adding to this:

TODO Qutebrowser

  • Create a better ym that automatically escapes things like |
  • Resurrect since I really really miss it as my place to organize stuff

Day 436

Tensorflow Keras reset states of everything

Everytime I call it does NOT reset the weights, DOES reset the hidden states (such as RNN/LSTM), does NOT reset optimizer settings. machine learning - re-initialises the weights - Stack Overflow

If I want to reset them, keras.backend.clear_session() should clear the info from the previous model.

Day 434

Matplotlib/pyplot reset styles

If I set a style like paper with'paper') it changes some settings (esp. in Jupyter Notebook) that don’t get overwritten by the next calls to For this,'default') exists. (Found here: python - How to recover matplotlib defaults after setting stylesheet - Stack Overflow)

Matplotlib have lines of the same colours when cycling / set line colour explicitly

Found here: python - How to set same color for markers and lines in a matplotlib plot loop? - Stack Overflow

The idea is to access the colour cycle directly:

    ax = plt.gca()
    color = next(ax._get_lines.prop_cycler)['color']
    plt.plot(x, y, linestyle='', markeredgecolor='none',, color=color)

Also I learned that there’s a nice way to get a value for ax when I don’t have it: ax=plt.gca() And that I should look into itertools because this is really neat (TODO: Look into itertools):

marker = itertools.cycle(('o', 'v', '^', '<', '>', 's', '8', 'p'))

Matplotlib get list of available styles

The list of available styles in matplotlib:

To use:'paper')

Matplotlib adjust subplots

When creating a plot with many subplots via a loop I had the issue that they were too close together. Fixed with plt.subplots_adjust(): matplotlib.pyplot.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=None, hspace=None)`

matplotlib.pyplot.subplots_adjust — Matplotlib 3.1.2 documentation

Matplotlib subplots

TODO add what I finally understood about the location of the subplots

Day 430

German - Geburtsname

Geburtsname: Vorname oder Nachname - Das versteht man darunter - FOCUS Online

Müssen Sie in einem Formular Ihren Geburtsnamen angeben, handelt es sich um Ihren Nachnamen, den Sie bei Ihrer Geburt erhalten haben. Sofern Sie nicht geheiratet und den Namen Ihres Ehemanns oder Ihrer Ehefrau angenommen oder eine Namensänderung beantragt haben, können Sie hier Ihren aktuellen Nachnamen angeben.

Bash/terminal command with a certain percent chances of running

[ $[$RANDOM % 10] = 0 ] && do_this || do_that “s gives roughly a 1 in 10 chance of do_this running, and a 9 in 10 chance of do_that running. You can omit || do_that to just have a 10 percent chance of do_this running.” (seen here: Clear Your Terminal in Style - Adam.)

Vim vimmotion plugin in visual mode

The vim vim-easymotion plugin (easymotion/vim-easymotion: Vim motions on speed!) also works in select/visual mode!

EDIT: there’s an intellij idea plugin! Just wow

Intellij Idea / Ideavim / Easymotion plugin

I’m very very very glad about this, this is one thing that I missed from vim! AlexPl292/IdeaVim-EasyMotion: EasyMotion emulation plugin for IdeaVim

To activate I had to add set easymotion after setting the leader key in .ideavimrc.

I just to not-forget about it.

Day 429

Python imports

Python ‘No module named’ error; ‘package’ is not a package - Stack Overflow TL;DR Beware of conflicting filenames.

I keep getting bitten by this - if I have a folder called something and inside it something called and want to import something from the folder, it will take something to mean instead of the folder.

Quoting the most helpful answer:

I was using the same name for both a sub-package (directory) and a module (file) within it.

For example I had this:

    /opt/mylib/myapi/        # gitignored file for user/pass
    /opt/mylib/myapi/              # base module, load creds and connect
    /opt/mylib/myapi/      # call and do work

The script ‘’ imports credentials from via this statement:

    from myapi.myapi_creds import my_user, my_pass
Testing the module '' resulted in this error:
    $ ./
    Traceback (most recent call last):
      File "./", line 12, in <module>
        from myapi.myapi_creds import my_user, my_pass
      File "/opt/mylib/myapi/", line 12, in <module>
        from myapi.myapi_creds import my_user, my_pass
    ModuleNotFoundError: No module named 'myapi.myapi_creds'; 'myapi' is not a package

The solution was to rename to so it’s name does not collide with the sub-package name.

Markdown code in quotes

Is there a way to put code blocks in block quotes? - Meta Stack Overflow TL;DR Code is indented four spaces, but inside a quote (>) they have to be indented five spaces.

English - dingbat

dingbat - Wiktionary - crazy person - typographical ornament (like arrows) - small device/gadget the correct term for which is forgotten/unknown

Scipy normality test

scipy.stats.normaltest — SciPy v1.4.1 Reference Guide - function returns amongst other things p-value that the sample comes from a normal distribution.

Meaning of buffer_size= in dataset.shuffle()

tensorflow - Meaning of buffer_size in , Dataset.prefetch and Dataset.shuffle - Stack Overflow

It affects how random the shuffle is. A buffer size of 1 would not shuffle at all, one bigger than the dataset would be perfect. It’s basically the size of the randomly created bucket from which we pick the next element.

Day 428

Tensorflow running eagerly TODO

What is the difference between setting run_eagerly while compiling a tf.keras model vs setting it after compilation vs tf.config.experimental_run_functions_eagerly(True)?

Tensorflow saving models blues

As of Di 03 Mär 2020 17:11:47 CETA, it seems saving weights both in .h5 format and tf format is broken. For TF format, [TF2.0] Bug when saving weights with custom layers · Issue #26811 · tensorflow/tensorflow, you should use .h5; For .h5, Tensorflow 2.x seems to use the same names of Variables if they are unnamed, which creates conflicts when saving. The fix is to name all the variables: Custom layer weights all have the same name by default · Issue #36650 · tensorflow/tensorflow

Zinc for common colds

This paper: Zinc for the common cold—not if, but when says that it’s conclusive evidence that it helps at <24h after the start and that it reduces the risk of colds. I’m not sure I understand what’s the right dose though

Day 427

Tensorflow Dataset API split to train/test

Splitting a tf Dataset is surprisingly hard. Best option is

test_dataset = all_dataset.take(1000) 
train_dataset = all_dataset.skip(1000)

Along with stuff like this if you know the dataset size:

train_size = int(0.7 * DATASET_SIZE)
val_size = int(0.15 * DATASET_SIZE)
test_size = int(0.15 * DATASET_SIZE)

(Though I don’t see any fuction to get a dataset size from the Dataset).

Both from Split a dataset created by Tensorflow dataset API in to Train and Test? - Stack Overflow

Day 422

Qutebrowser clear all finished downloads

Added this to config.bind('<Ctrl-I>', 'download-clear')

Python string sanitization

Different ways to ‘sanitize’ a list of strings to ensure they don’t contain any of the contents of another ‘ignored’ list

Day 420

Change volume on different soundcard

Added the following lines to .config/i3/config:

bindsym Mod1+r exec amixer -c 1 set PCM 5%+ && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show
bindsym Mod1+c exec amixer -c 1 set PCM 5%- && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show

bindsym Mod1+Shift+r exec amixer set Master 5%+ && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show
bindsym Mod1+Shift+c exec amixer set Master 5%- && amixer get Master -D pulse | egrep -o '([0-9]+)%' | egrep -o '[0-9]+' | xargs -0 volnoti-show

Now there are two shortcuts for two volumes :)

Use vim to change encoding of file

:set fileencoding=utf8, then :w newfilename.

Day 417

Taskwarrior project:

project:myproject can be replaced by pro:myproject

Meta - Diensttagebuch

Updated the layout to output 10 posts in full and 10 as links on the first page, instead of the previous 3/7.

English Idioms

See the writing on the wall - Idioms by The Free Dictionary — “To notice and interpret apparent signs or indications that something will or is about to happen in the future, especially something bad or unfortunate.”, “To know something is about to happen”. Found here.


Spent a lot of time understanding why do i3 and my mouse and Intellij Idea not work, fix was removing the headphones that were pressing a mouse button on the laptop.

Day 416

Transformer & BERT ML article

NLP — BERT & Transformer - Jonathan Hui - Medium is probably the best explanation of the Transformer and BERT I’ve even seen.

Fill paragraph, Knuth and psychologically bad breaks

Implement Fill Paragraph for coments · Issue #2737 · intellij-rust/intellij-rust

This is fascinating problem, originally solved by Knuth himself, and a primarily example of dynamic programming: However interesting the problem might be, I’d rather my IDE solved it, and not me :-)

TODO - read it sometime maybe, I’ve skimmed through it and it looks very interesting.

Intellij Idea ideavim plugin remove keybinding

Predictably to remove a keybinding imported from .vimrc in .ideavimrc the usual syntax is used: unmap <C-h>

Intellij Idea Ideavim go to last modified line

The vim shortcut '' works in ideavim as well!

General idea about Tensorflow and writing stuff for it

It’d be nice to have fixed values (and especially dimensions!) for my tensors that I use for testing stuff such as layers. If my input tensors’ dimensions are predictable, like [10, 9, 8, ...] for each dimension, I’d be able to recognize them immediately at various stages without having to think about it. For a level up, I can consider for example Fibonacci numbers or similar, that have different divisors, so that the program will fail early and predictably if I do something wrong.

Otherwise I kinda like the approach of Tensor Considered Harmful, especially the part where dimensions have human-readable names.

Deutsch / Jour fixe

TIL: Jour fixe ist ein in einer kleinen Gruppe von Personen fest vereinbarter, regelmäßig wiederkehrender Termin (Regeltermin), zum Beispiel „jeder zweite Donnerstag im Monat“. In der Arbeitswelt wird zu diesem Regeltermin meist eine Besprechung durchgeführt.

reStructuredText for Python documentation

7. Documenting Python — Python Developer’s Guide is something I can try to follow. PEP 287 – reStructuredText Docstring Format | has more examples.

Getting permanent links to files - GitHub Help tells me to press y for the URI to update to the permanent link to that version of the file.

Ideavim search seems “smart” by default, ignores case unless I use case in my search.

Day 415

Ambient sleeping pill

Ambient Sleeping Pill – Internet Radio for Sleep, Meditation & Relaxation is what it says it is. Background music is okay. “For sleep, meditation or study”. Nice alternative to

Intellij idea “Add as content source” getting ignored that leads to “module not found” in Python depending on the order of the files of $PYTHONPATH and/or sys.path

I had two modules, both marked as source roots, with conflicting subfolder names. It could not find modules inside the second folder. Right click → Unload modules helped; I could unload the conflicting module, after this it happily started importing the files from the second source root. This is a band-aid fix but for now it works; TODO later find out a better way to solve these problems.

If not, there are always uglier hacks like sys.path.extend(['folder_marked_as_source_root_that_doesn't_seem_to_get_added_to_$PATH'])

Emulate Python prompt during debugging in Intellij Idea

An interactive shell can be used during debugging in intellij idea! See Interactive console during debug? – IDEs Support (IntelliJ Platform) | JetBrains

Keras saving model ‘Not JSON Serializable’ error

Cannot export Keras model TypeError: (‘Not JSON Serializable:’, b’\n…’) · Issue #27112 · tensorflow/tensorflow - yet another reason to use Keras’ own methods. tf.concat -> tf.keras.layers.Concatenate etc etc etc.

Keras loading weights from only some layers of the model

machine learning - How to load only specific weights on Keras - Stack Overflow

If your first 9 layers are consistently named between your original trained model and the new model, then you can use model.load_weights() with by_name=True. This will update weights only in the layers of your new model that have an identically named layer found in the original trained model.

Day 414

NLP Reddit

Natural Language Processing exists and is surprisingly active.

Keras Transformer Bert implementation

kpot/keras-transformer: Keras library for building (Universal) Transformers, facilitating BERT and GPT models is a non-official Transformer and Bert implementation using Keras >= 2.0

Stanford CS 224N - Natural Language Processing with Deep Learning

Stanford CS 224N | Natural Language Processing with Deep Learning has lectures, slides etc etc etc. Based on the lecture 06 from 2019, it’s freaking awesome, I really like the way the slides are done. I really really really like the way slides are done. In general that course would answer most of the questions I’ll ever have

It also has literature suggestions, all free to read online. Very glad I found it.

Day 413


A Snowclone is a cliché and phrasal template that can be used and recognized in multiple variants.


  • Eskimo words for snow
  • In space, no one can X
  • X is the new Y
  • The mother of all X
  • X-ing while Y
  • To X or not to X
  • Have X, will travel
  • X considered harmful

Another explanation of Transformer - “The Annotated Transformer”

The Annotated Transformer seems the very best explanation I’ve found. It’s a Jupyter notebook, very detailed and containing an implementation. Link found here: course-nlp/8-translation-transformer.ipynb at master · fastai/course-nlp which in turn is a Jupyter Notebook used in this nice Youtube video lecture: Introduction to the Transformer (NLP video 17) - YouTube.

In this post I present an “annotated” version of the paper in the form of a line-by-line implementation. I have reordered and deleted some sections from the original paper and added comments throughout.

In general everything posted by the Harvard NLP team is very interesting for me especially: Code. It’s all nicely visualized and/or with source code.

Linux watch command

It runs a command continuously and updates the screen when the output changes. Found in my zsh history, watch nvidia-smi is one example.

Heaps’ law

Heaps’ law - Wikipedia “is an empirical law which describes the number of distinct words in a document (or set of documents) as a function of the document length (so called type-token relation)”. In “See also” it has quite a large amound of other “laws” which may be interesting.

Day 409

unittest @skipUnless Python unit testing

models/ at master · tensorflow/models uses a neat thing:

@unittest.skipUnless(tf.test.is_built_with_cuda(), 'requires GPU')
def test_train_1_gpu_with_dist_strat(self):
  FLAGS.distribution_strategy = 'one_device'
  t = transformer_main.TransformerTask(FLAGS)

Linux keyboard compose key

Yet another change to the layout - now compose lives on rwin: setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin' v4,ru &

This makes the entire file as follows:

setxkbmap -option -option 'grp:rctrl_toggle, compose:rwin' v4,ru &
xrandr --output HDMI-2 --mode 2560x1440 --pos 1920x0 --rotate normal --output HDMI-1 --off --output DP-1 --off --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-2 --off
xcape -e 'Control_L=Escape' -t 100  &
xmodmap ~/s/mod4 &
keynav &

Day 408

Python ModuleNotFoundError ‘requests’

To get requests one has to install requests-html. requests might already be installed.

Why did I get ModuleNotFoundError instead of ImportError? Apparently it’s new in Python 3.6 and it’s a subclass of ImportError, just more precise; catching ImportError would work for it too.

Programming cases name

From naming - What are the different kinds of cases? - Stack Overflow:

  • Flat case: myvariable
  • Kebab case: my-variable (this is the most famous. Other names include: caterpillar case, dash case, hyphen case, lisp case, spinal case and css-case)
  • Camel case: myVariable
  • Pascal case: MyVariable (other names: capital camel case)
  • Snake case: my_variable (other names: c case)
  • Macro case: MY_VARIABLE (other names: upper case)
  • Cobol case: COBOL-CASE (other names: Train case)

Day 407

Vim “Done” map/macro

The following inside the .vimrc moves the selected line to the end of the file and takes the cursor back: map <C-d> dGp''

For details, cursor movement - How do I jump to the location of my last edit? - Vi and Vim Stack Exchange.

From the first answer:

The \`. command will bring you to your last change.

The \` goes to a mark, and . is a “special” mark which is automatically set to the position where the last change was made. See :help `. for some more information.

There is also `` which will bring you back to where the cursor was before you made your last jump. See :help \`\` for more information.

Another useful mark is \`^; this is the position where the cursor was the last time when insert mode was stopped. See :help \`^.

See :help mark-motions for some more general info about using marks (including some other “special” marks that are automatically set).

Day 406

English / ML - ablation study/analysis

(20) In the context of deep learning, what is an ablation study? - Quora, may God forgive me for a Quora link -

An ablation study typically refers to removing some “feature” of the model or algorithm, and seeing how that affects performance.


An ablation study is where you systematically remove parts of the input to see which parts of the input are relevant to the networks output.

First seen in page 3 of Deep contextualized word representations

Knowledge wikis

Gabor Melli’s Research Knowledge Base looks to be basically what I’ve tried to do. His layout for the posts is also interesting, for example see here: Personal Blog - GM-RKB It has a Context, Example(s), Counter-Example(s), and References. But I can't find any meta-level page describing this Gabor Melli’s Knowledge Base (GM-RKB) - GM-RKB. Usually the more interesting topics contain other stuff, such as Meaningless Universe Theory - GM-RKB the References contain actual quotes.

I really really really want to resurrect my own wiki.

Tensorflow v1

    x = e.__call__(myinput)

    sess = tf.Session()
    result =

The tf.global_variables_initializer() gets rid of “Attempting to use uninitialized value” errors.

CNN visualization (ML)

How to visualize convolutional features in 40 lines of code has very cool pictures of intermediate layers of a CNN, along with pictures that seem to fit to it. This is realyl really cool.

qutebrowser bindings

qutebrowser/.config/qutebrowser/autoconfig.yml · 39516940c80b70bab059e563a129709882f4a41e · Jay Kamat / dotfiles · GitLab has very interesting bindings, with interesting commands like fake-key and stuff, along with per-websites(?) bindings; javascript whitelisting.

CNN tutorial

Again I come back to this nice resource: 6.4. Multiple Input and Output Channels — Dive into Deep Learning 0.7.1 documentation

It has a very nice explanation of CNNs and in/out channels and stuff.

Especially output channels:

Regardless of the number of input channels, so far we always ended up with one output channel. However, as we discussed earlier, it turns out to be essential to have multiple channels at each layer. In the most popular neural network architectures, we actually increase the channel dimension as we go higher up in the neural network, typically downsampling to trade off spatial resolution for greater channel depth. Intuitively, you could think of each channel as responding to some different set of features\o(6.4. Multiple Input and Output Channels — Dive into Deep Learning 0.7.1 documentation)

Duckduckgo I’m feeling lucky

This is awesome! Works with a backslash: \tf.nn.maxpool

Day 403


tf.math.count_nonzero() works for booleans, as in “number of True elements in tensor”

Python mutable/immutable dictionaries/lists changing inside a function

Tutorial: Why Functions Modify Lists, Dictionaries in Python just got bitten by this again :) TL;DR lists and dicts are mutable, therefore if I pass them to a function and it does stuff to it they will get changed outside the function too. dict.copy() helps.

Day 401

Adding to dtb

One thing which I continuously missed was a way to quickly search through all the files visually - :Ag as fuzzy search is a really nice solution, but I still like the usual way. So now the following was added:

cat * | grep -v "layout: post" | grep -v "categories: \[\]" > ../

This is purely a text file that I plan to work with as a text file (though it gets compiled to .html during deployment), and we’ll see what happens next with it.

Random / interesting

Compass rose - Wikipedia, especially the names of the winds. I wonder if they could become names for hostnames/servers or something.

CNN Tutorial - Machine Learning

Simple Introduction to Convolutional Neural Networks is really nice and has pictures of swans.

Day 396

Taskwarrior .zsh alias current sprint change

Changed zsh alias to alias s='task s$SPRINT or sprint:c', it didn’t have the .is before showing me 40, 41… for sprint 4 etc.

Taskwarrior seq recurring tasks commands

For next year:

10270  for i in $(seq 4 9 52)\nt add project:h +MOD  sprint:$i change toothbrush
10272  for i in $(seq 4 4 52)\nt add project:h +MOD  sprint:$i Master monthly backup

Day 395



And let’s come back to an old favourite of this Diensttagebuch…

Today's Sets
1.D3B 86% 1m. 27s.
2.D4B 56% 1m. 48s.
3.D4B 28% 1m. 48s.
4.D4B 39% 1m. 48s.
5.D4B 39% 1m. 48s

Day 394

Intellij idea shortcut for closing tab

Ctrl+F4 closes the current tab, which is not too easy to type. But I set a nice shortcut Ctrl-I which is not, action is “Close all unmodified”, it closes all the tabs I usually close manually - all internal TF stuffs that open when debugging and that I don’t want to change or edit (but breakpoints are okay, and they don’t seem to count as “modification”)

qutebrowser edit current url

go is the default shortcut for this.

Tensorflow masking function not_equal

This is very nice and easy and easy to forget: mask = tf.not_equal(inputs, '')

It has sisters such as tf.math.less, etc.

Tensorflow python unittests check for equality of two tensors

tf.assertEqual(x, y) exists, can be used in unittests as is, if it raises an error the test automatically fails.

Intellij idea generate tests

This is awesome! Right click on class name -> Generate -> Test, and this creates a boilerplate file with the right name and right methods.

Day 392

Python truthy and falsy

TIL that values considered true/false without being explicitly True/False have a name, and from python - What is Truthy and Falsy? How is it different from True and False? - Stack Overflow here’s a handy list of them:

All values are considered “truthy” except for the following, which are “falsy”:

  • None
  • False
  • 0
  • 0.0
  • 0j
  • Decimal(0)
  • Fraction(0, 1)
  • [] - an empty list
  • {} - an empty dict
  • () - an empty tuple
  • '' - an empty str
  • b'' - an empty bytes
  • set() - an empty set
  • an empty range, like range(0)
  • objects for which
    • obj.__bool__() returns False
    • obj.__len__() returns 0

A “truthy” value will satisfy the check performed by if or while statements. We use “truthy” and “falsy” to differentiate from the bool values True and False.

Truth Value Testing

Day 389

Python type hinting

Allegedly one of the best tutorials to start with: Type hinting and annotations — Python for you and me 0.4.alpha1 documentation, link found here: A deep dive on Python type hints · Vicki Boykis. That blog in general is quite interesting, she’s the same person who wrote IT runs on Java 8 · Vicki Boykis.

Random - good small datasets

From the same blog above, Good small datasets · Vicki Boykis is nice. TIL datasets can have documentation.

Tensorflow SequenceExamples to and from String

tf.train.SequenceExample.FromString(se.numpy()).SerializeToString()==se, logically. They can be parsed without an extract function and

Day 387

Tensorflow py_function in mapping and Raggedtensors

    one, two= tf.py_function(func = py_mix, inp=[one, two],  Tout = (tf.int32, tf.int32))

one is a RaggedTensor. This gives an error:

TypeError: Tensors in list passed to 'input' of 'EagerPyFunc' Op have types [<NOT CONVERTIBLE TO TENSOR>, int32] that are invalid. Tensors: [tf.RaggedTensor(values=Tensor("RaggedFromVariant/RaggedTensorFromVariant:1", shape=(None,), dtype=int32), row_splits=Tensor("RaggedFromVariant/RaggedTensorFromVariant:0", shape=(None,), dtype=int64)), <tf.Tensor 'RaggedFromVariant_1/RaggedTensorFromVariant:0' shape=(None,) dtype=int32>]

one.to_tensor() converts it to Tensor and this works.

Additionally, if I set Tout to be only one value, I get a nice descriptive error: OperatorNotAllowedInGraphError: iterating over tf.Tensor is not allowed: AutoGraph is disabled in this function. Try decorating it directly with @tf.function.

Giving a type for both outputs fixes this.

Tensorflow RaggedTensor and Tensor evaluation

Ragged tensors  |  TensorFlow Core gives a nice breakdown of the ways to evaluate a Tensor in general:

  • print(rt.to_list())
  • print(rt[1].numpy())
  • Printing the constutuents of it:
    • print(rt.values)
    • print(rt.row_splits)

Intermezzo - 2

Три истории про Мерзебург

Вот про Мерзебург надо писать на русском языке, на самом деле, хотя нереально объяснить почему.

Сижу за идеально пустым столом комнатки где провел предыдущие 4 года. Вокруг какие-то непонятные бумаги на полу, какие-то ручки, как будто после урагана.

Now playing: Stravinsky - Le sacre du printemps / The Rite of Spring

Господи, сколько же всякого происходило тут за последние 4 года.

Сижу за знакомым столом, который на идеальной высоте, куда идеально ложатся локти. Хотя все вещи кроме общажной мебели отсюда увезены, чудом осталась свечка и спички. Сейчас она горит и пахнет воском, тоже до боли знакомый запах, с точностью до всех нот - конкретно такие свечки и покупал 4 года подряд. И писал на таких листочках А4, тем же почерком, той же рукой.


Свеча выглядит как будто она догорит сегодня, и это лучшее и самое правильное совпадение этого мира.

Комнатка прошла полный круг - а изменился ли я?

А еще - город где была сфокусирована моя жизнь довольно долгое время. Сейчас тут пустая комната, за окном - темнота, хорошие люди в городе и самом общежитии в общем-то остались, но само нахождение тут как-то просто странно. Очень хороший повод порефлексировать о том, как можно себя чувствовать совершенно чужим в каком-то городе, особенно по вечерам. Помню летние месяцы тут - за окном лето, ты в напрочь пустом общежитии маленького городка восточной Германии, чувство свободы и пустоты, лето, бесконечное лето, лето как состояние. С работой это все будет стираться, и надо пытаться себя учить замечать маленькие детали в изменениях сезонов, иметь хоть какие-то ритуалы связанные с разными порами года, чтоб это не сливалось и чувствовать, к приеру, лето, про-живать, пере-живать сезоны. Постик об этом, отчасти.

Но это все лирика, лирика которая не должна отвлекать нас от того, что на самом деле важно -


Слева от меня два огромных окна, традиционно жертвы моей любимой темы писать на окнах и давать хорошим людям писать на моих окнах. Очень много этих надписей связаны с вполне конкретными людьми и воспоминаниями.

Все что следует написано очень многими разными почерками и размерами и цветами, кроме левой половины первого окна.


Окно 1, левая половина

Life is a non-0-sum game.

"Nothing exists except atoms 
and empty space. Everything 
else is opinion" - Democritus 
    ____ - - -
                - RUMI


I make my own coincidences, 
synchronicities, Luck, 
    and Destiny.


Rule your mind,  or it will rule you.


Безумие, безумие, безумие.
              (с) М.

 Рисунок роботов, вид сверху. 

Окно 1, правая половина

L'occhio del lupo Amazon

U: ---/---
P: admin123


Рисунок круга с точкой внутри

Leave tonight 
or live and 
die this way.

padik is where your
    semki shells lie

 Еще одна схема робота, одного,
вид прямо 

 Рисунок слона, подписан Ellina

Szerb: Reise
im Mondlicht

Это все
часть пути

Now playing: Händel - Sarabande, просто самая сильная извесная мне композиция. Мурашки по коже.



Окно 2, левая половина

-- Что мне терять 
на этоп этапе?
-- Этап.


Matthew 6:33

Wovor laüfst
du weg?

 Непонятный рисунок с квадратиками, кружочками и штрих-пунктиром. 
    We were dringking
       with Ukrainians!


 Рисунок короны

 Рисунок трех синусоид, суммирующихся в 1 

 Две неразборчивых надписи

6C | 2-3

   Wo bist du?

 Еще одна неразборчивая надпись

Buch "Krabat"
 (↳ O.Preußler)


         Логитип BMW 

 Рисунок земли, над ней шар,
вокруг шара концентрические стрелочки
Под ним: "2001"

I fucking like



Окно 2, правая половина

 Большой рисунок 
каббалисткого Древа Жизни,
с буквами на иврите внутри 

10:45 am

Мыло для бульбашек

 Рисунок лица в очках 
Сережа ня :3

"Я тебя щелкну
как семку!"
    (с) Женя

 Рисунок Дао  

(i) 1:17

 Странный рисунок лошади (?)
перехоящей в ботинок (?) 

   Der kleine Prinz
   ist bei mir! 
    - Yasmin
    lies das 

 Рисунок графика
и минимумов в нем 


Он хотел историй
Он ее получит [sic]




Тут еще будет уместен этот линк на пост, написанный когда я только-только приехал сюда: Файне місто Мерзбург | Я сам, соломка, чай.

Сложно написать что-то общее про Мерзебург и мое отношение к нему. Если бы писал, то “блеск и нищета” точно бы звучало. Чем-то очень темный город, маленький, по-своему в некотором роде некоторым образом уютный, без лишних претензий. Но все же, темный, давящий, причем давящий с самого начала. Все хорошее, что я мог про него говорить, было скорее стокгольмским синдромом и рационализацией.

Если город маленький, общение с людьми приобретает чуть больше граней. И общение с городом-вообще, где ты знаешь в лицо всех кассирш ближайшего магазина, единственного филиала банка, где четыре года подряд ходишь в одну аптеку и тебя там узнают, и ты узнаешь всех (двух) людей, которых ты там когда-либо видел за прилавком.

Как будто личности, которые часть этого города, имеют более прочную позицию в нем, имеют чуть большее значение. Ты встречаешь дедушку на лавочке, болтаешь с ним - дедушка важен, лавочка важна, озеро, около которого она, тоже важно. Ты не анонимен и лавочка не анонимна. Все имеет больший масштаб и связь между всем сильнее.

Вне этого - если что-то тебя давит, то город беспощаден, и тебе в нем не затеряться и не отвлечься. Сенека что-то писал про то, что постоянные переезды и путешествия – признак беспокойного духа. Мне кажется надо иметь нереально спокойный дух, чтоб мочь долго жить в маленьком городке.

Не Инсмут

А если иметь спокойный дух - условия в принципе идеальные. Маленький универсистет, университет в 50 метров от общежития. 200 метров дальше - спортивный комплекс. Там можно играть в теннис с людьми, которых туда приглашаешь. По дороге туда встречаешь всех. А в тренажерном зале встречаешь местами преподавательницу немецкого языка, местами - ректора, который стоит и ждет своей очереди на тренажер у тебя над душой, что очень неловко всем.

Мерзе это город где к тебе могут просто зайти и пригласить выйти погулять, и ты идешь и просто гуляешь по территории и по Tiergarten, до которого метров 500. Это город где шикарно гуляется ночью. И шикарно разговаривается ночью.

Это город, в котором нереально хорошо видны звезды, все, и ночью можно ходить на них смотреть в кукурузные поля (до которых метров 700). Где есть крыша, на которую можно залазить и оттуда смотреть на затмение.

Это город где ты идешь в магазин за едой и это интересно, и это развлекаловка, и ты резко понимаешь в чем может быть прелесть шоппинга.

Мерзе меня многому научил. От того, как это, когда вокруг у тебя Мерзебург, где мало что происходит, а ты хочешь чего-то интересного - и ты учишься to make your own fun и организовываешь вещи.

Эти 4 год атут были мне очень необходимыми и уместными, продлились ровно столько, сколько нужно, и закончились в идеальное для этого время.

В эти секунды тушится свечка.

Спасибо тебе, свечка, спасибо тебе, столик.

Спасибо тебе, здание 5B.

Спасибо тебе, Мерзебург, спасибо за все.

Day 385

Hammock driven development (video); towatch

Hammock Driven Development - Rich Hickey - YouTube looks like an interesting video. Also it’s transcripted! talk-transcripts/ at master · matthiasn/talk-transcripts Rich Hickey – Hammock Driven Development – is a post about the same.

Intellij idea bookmarks!

Ctrl+Shift+3 to toggle bookmark 3, and Ctrl+3 to jump to it


Building a data pipeline for tf.Dataset.

Day 384

Number bases in bash

bash - Value too great for base (error token is “08”) - Stack Overflow – tl dr bash/zsh see “018” as an octal number because it starts with 0. To fix this, we explicitly set the number base: 10#$varname.

I updated my with this. Now the lines are like this:

FILE=_posts/$(date +%Y-%m-%d)-day$((365+10#$(date +%j))).markdown

Day 019

Day 379

Semantic highlighting

This is actually really nice as idea, and as usual someone on the internet thought about this more than I did: Making Semantic Highlighting Useful - Brian Will - Medium

I somehow really like the idea of having color giving me actual semantic information about the thing I’m reading, and there are a lot of potentially cool stuffs that can be done, such as datatypes etc. It’s very connected to my old idea of creating a writing system that uses color to better and more concisely mark different letters, like the apparently defunct Dotsies but even more interesting.

Zsh autosuggestions (fish-like)

This is interesting: zsh-users/zsh-autosuggestions: Fish-like autosuggestions for zsh

Less noisy autocomplete than the default, should look similar to this: fish autocomplete

As a side note I like the cat explanation.txt part for screenshots.

Day 378

Adding numbers in Bash

integer arithmetic - How can I add numbers in a bash script - Stack Overflow

num=$((num1 + num2))
num=$(($num1 + $num2))

.. which is what I used in the updated script. FILE=_posts/$(date +%Y-%m-%d)-day$((365+$(date +%j))).markdown


  • TODO - why can’t tf.convert_to_tensor() convert stuff to other types (int64->float32) and I have to use tf.cast() afterwards?
  • tf.in_train_phase() – both x and y have to be the same shape
  • In a custom layer, compute_mask() can return a single None even if there are multiple output layers!



Day 013

German random

The Ctrl key in Germany is “Strg”, pronounced “Steuerung”

English random

refuse - Dictionary Definition : Refuse as a verb is re-FYOOZ, as a noun it’s REF-yoss.

Day 012

Day 011

Taskwarrior end of year sprint renaming

The usual yearly ritual:

for o in $(seq 52) 
t$o modify sprint:2019-$o rc.bulk=0

Here a couple of things are interesting. Firstly,$o means basically sprint==$o. In cases where sprint==2, this helps against catching stuff life sprint==20 in the filter.

rc.bulk=0 is an override of the setting bulk which decides how many changes at the same time is too many. Regardless of the value of the confirmation setting. Here I set it to infinity, and this way I don’t get one question for each sprint.

Also Setting Up Multiple Project Areas with Taskwarrior – Steve Dondley is quite interesting – I’ll do something similar for work and home, except that I’ll use the existing t/tw aliases instead switching it like he does. But I might consider something like this so that t at work gives me the work tasks and my home tasks at home.

cp copy to target directory by overwriting the contents

linux - How to force ‘cp’ to overwrite directory instead of creating another one inside? - Stack Overflow

-T, --no-target-directory treats target as a normal file, not a directory. -v is also quite handy.

Lastly, I’m not sure how does taskwarrior work. When I try to delete ~/.task it gets recreated with the standard files, but empty ones, as if it was a clean taskwarrior install. I don’t see any task-like processes running. I’m not sure how is this possible.

Random / other / toread

Super Guide to the split-window tmux Subcommand (and Beyond) – Steve Dondley looks awesome. In general I’d like to spend 2020 by learning to use existing tools better - the taskwarrior .is attribute is something I had to look for.

Day 363



Chaostreff – Eigenbaukombinat

Day 354

Tensorflow eager execution

Makes everything slower by about 2-4 times.

Day 353


tf.keras.backend.in_train_phase  |  TensorFlow Core r2.0 selects x if training, y otherwise. This will be very handy later.

Intellij Idea folds

Just discovered that Ctrl + and Ctrl - unfold and fold stuff.

Ideavim actionlist

IdeaVim actionlist

Added the following to .ideavimrc:

map J :action NextTab<CR>
map K :action PreviousTab<CR>
map <leader>j :action EditorJoinLines<CR>

Python print all class variables



Day 350

Tensorflow object has no attribute _keras_history

AttributeError: 'tensorflow.python.framework.ops.EagerTensor' object has no attribute '_keras_history disappears if we dont’t use eager execution inside the metric, fine if we use it inside the model. That is tf.config.experimental_run_functions_eagerly(False) inside solves this, but model.run_eagerly=True is fine. re output_masks and it being blocked

tf.keras vs tf.python.keras

tensorflow - What is the difference between tf.keras and tf.python.keras? - Stack Overflow

Day 347

Zsh calculator inside CLI

# Put these in your .zshrc (No need to install a plugin)
cc() python3 -c "from math import *; print($*);"
alias cc='noglob cc'
# You can use `cc` just like `=` from above. All functions from the math module of Python are available for use. 

(As suggested by arzzen/calc.plugin.zsh: zsh calculator - with support for basic math)

Usage: cc 3+3

Zsh disable globbing

If a command is prefixed by noglob, then no globbing is performed on its arguments (source: wildcards - Disable glob qualifiers in zsh - Unix & Linux Stack Exchange)

Day 344

Python shell get last value

_ does the magic. Can be used in expressions too.

Day 343

Python unittest

  • When creating a TestCase, all vars set up in setUp should belong to the class –
  • The functions run in alphabetical order but it’s not something I should depend on

Stack / ideas

Some kind of ML language switcher that trains on my input – I write something in L1, delete, write same keystrokes on L2 => training instance. Also based on window class and time maybe?

Tensorflow ‘could not find valid device for node’

“Could not find valid device for node.” while eagerly executing. - means wrong input type.

Day 338


Mixing keras and tf.keras is bad karma; only the same one should be used and it should be tf.keras.

Tensorflow Keras stuff outside layers

AttributeError:’Tensor’ object has no attribute ‘_keras_history’ –

Everything should be done by:

  • Using keras.backend functions,
  • Lambda layers,
  • Designated keras functions with the same behavior.

When you are using tf operation – you are getting tf tensor object which doesn’t have history field. When you use keras functions you will get keras.tensors.

Day 337

Intellij idea breakpoints

I should read this sometime: Breakpoints - Help | IntelliJ IDEA

Qutebrowser Stack

I should create a better ym that supports copying markdown links that have |s in them. Using Add ability to yank inline by jgkamat · Pull Request #4651 · qutebrowser/qutebrowser · GitHub most probably.

Tensorflow boolean mask

tf.boolean_mask  |  TensorFlow Core r2.0 is something similar to what I do with tensor*mask, but it removes the rows where the condition is not fulfilled.

Day 336

Tensorflow custom metrics return

Keras custom metrics raises error when update_state returns an op. · Issue #30711 · tensorflow/tensorflow · GitHub - forget about returning ops in custom metrics, internal Google TPU issue thing. It’s supposed not to work. Error was:

TypeError: To be compatible with tf.contrib.eager.defun, Python functions must return zero or more Tensors; in compilation of <function Function._defun_with_scope..wrapped_fn at 0xb34ec5d08>, found return value of type <class 'tensorflow.python.framework.ops.Operation'>, which is not a Tensor.

Tensorflow documentation

tf.assign_add - TensorFlow Python - W3cubDocs - is this another place to read readable TF documentation?

Tensorflow eager execution – again; this time with Intellij idea breakpoints

model.run_eagerly=True is not enough – when creating a custom Metric, as mentioned in, tf.config.experimental_run_functions_eagerly(True) is also needed.

As added bonus - if this is not enabled, Intellij Idea debugging also doesn’t work. As in the breakpoints get ignored.

Day 331

CRF and probability tutorial / explanation / presentation

I really should resurrect my link DB.

Sandeep Aparajit: Tutorial: Conditional Random Field (CRF) is a nice 108-page presentation spanning basic probability theory and flowing to Bayes, marginals, CRF etc etc, very very self-contained.

To read / stack

Generative VS Discriminative Models - Prathap Manohar Joshi - Medium

Library for debugging ml stuff

Overview — ELI5 0.9.0 documentation “.. is a Python package which helps to debug machine learning classifiers and explain their predictions.”

Day 330


Tensorflow custom cost functions with different weights

Tensorflow F-score / PR

Tensorflow per-element multiplication

If I * a tensor by another tensor I get a per element multiplication. I keep forgetting this for some reason

Intellij idea debugging editing values

I can even edit EagerTensors by right click -> Edit value! Quite a weird UI but still nice

Day 329

Taskwarrior modifier .isnt for “not equal”

Edited my “someday” report: sprint:s sprint.isnt:srv

sprint:s seems to catch srv too, which I don’t want. Not anymore. Also Taskwarrior - FAQ is the list of such modifiers.

Attribute modifiers make filters more precise.  Supported modifiers are:

  Modifiers         Example            Equivalent           Meaning
  ----------------  -----------------  -------------------  -------------------------
                    due:today          due = today          Fuzzy match
  not               due.not:today      due != today         Fuzzy non-match
  before, below     due.before:today   due < tomorrow       Exact date comparison
  after, above      due.after:today    due > tomorrow       Exact date comparison
  none              project.none:      project == ''        Empty
  any               project.any:       project !== ''       Not empty
  is, equals       project == x         Exact match
  isnt              project.isnt:x     project !== x        Exact non-match
  has, contains     desc.has:Hello     desc ~ Hello         Pattern match
  hasnt,            desc.hasnt:Hello   desc !~ Hello        Pattern non-match
  startswith, left  desc.left:Hel      desc ~ '^Hel'        Beginning match
  endswith, right   desc.right:llo     desc ~ 'llo$'        End match
  word              desc.word:Hello    desc ~ '\bHello\b'   Boundaried word match
  noword            desc.noword:Hello  desc !~ '\bHello\b'  Boundaried word non-match

Intellij idea

In intellij idea you can set more options for each breakpoint after right-clicking on it; especially “disable until breakpoint X is hit”, where X can be disabled.

Keras2 eager execution

.. is not there by default all the time; the hard-to-find answer for this is adding model.run_eagerly=True after model.compile().

Tensorflow / python Dataset iterator

Of course, the following also works:

[x[1][1]['mycast'] for x in dataset.enumerate(5).__iter__()]

Tensorflow padding

… add what you tell it to add, even if you’ve use tf.one_hot() on the data before. Then you get weird zeros in the result of the one hot encoding.

Day 326

Moving to a new apt

Ausstattung für die erste eigene Wohnung - Checkliste is a nice checklist :)

Day 325

Day 324

Remark.js presentation change font size inside slide

.remark-slide-content {font-size: 40px;}

(from Font size · Issue #104 · gnab/remark · GitHub)

Also relevant are the content classes mentioned in how to adjust the font of a specific sentense/paragraph/word ? · Issue #230 · gnab/remark · GitHub:

Some text is .large[larger] and some is .small[smaller].

  .large { font-size: 130% } 
  .small { font-size: 70% }

Day 323

Tensorflow gradient propagation

  • ValueError: No gradients provided for any variable in Tensorflow - Stack Overflow

    When you do annotation_pred = tf.to_float(tf.argmax(out, dimension=4, name='prediction')), you get an index of the max value in your tensor. This index can’t be derivated, thus the gradient can’t flow throught this operation.

    So as your loss is only defined by this value, and the gradient can’t flow throught it, no gradient can be calculated for your network.

Argmax is okay if I don’t calculate my loss through it.

Python / Numpy ellipsis (…)

  • Cookbook/Indexing - SciPy wiki dump

    The ellipsis (three dots) indicates “as many ‘:’ as needed” This makes it easy to manipulate only one dimension of an array, letting numpy do array-wise operations over the “unwanted” dimensions. You can only really have one ellipsis in any given indexing expression, or else the expression would be ambiguous about how many ‘:’ should be put in each.

English vocabulary

  • glib - superficial, shallow, persuasive but insincere in nature.
  • retrodict - Wiktionary - to attempt to estimate the previous state from the present.

German RE / AW

Outlook. What is the meaning of “AW” in an email header? – AW == RE in most other languages

Day 317

Intellij ideavim toggle case

Added the following to .ideavimrc: map <leader>c :action EditorToggleCase<CR>


Using ‘categorical_crossentropy’ instead of ‘sparse_categorical_crossentropy’, give weird unintuitive errors

ML / NER / Stack / To read

This is a really nice tutorial with the basics that’s not too basic: Sequence Tagging with Tensorflow

Day 316

Tensorflow metrics ignored if loss doesn’t get defined

So I don’t forget, Metrics ignored when using model.add_loss() (like in VAE example) · Issue #9459 · keras-team/keras · GitHub currently happens.

Day 315

Qutebrowser :buffer/gt command to search tabs

:buffer works as a best-match tab filtering thingy, this in nice with 30+ tabs when tab number doesn’t cut it anymore


Tensorflow Datasets easiest way to look inside with an iterator


Tensorflow Keras Callbacks

How to compute f1 score for named-entity recognition in Keras

NER PRC and F-score (F1, metrics, precision, recall)

… uses only tags. As in, we don’t count the “not a name” tags at all during calculation of PRC. Otherwise the results would be too good. This is a NER-specific thing, though.

Current qutebrowser


config.bind(',l', 'set tabs.position left')
config.bind(',t', 'set tabs.position top')

config.bind(",j", "set content.javascript.enabled true")
config.bind(",J", "set content.javascript.enabled false")

config.bind(",T", "set multiple")
config.bind(",n", "set switching")
config.bind(",h", "set never")

config.bind(",o", "spawn --userscript")
config.bind(",m", "spawn mpv {url} --vid no")

c.url.searchengines = {'ss': '{}', 
        'g': '{}', 
        'c': '{}', 
        'DEFAULT': '{}', 
        'd': '{}',
        'w': '{}',
        'y': '{}'

mono = '10pt monospace'
small_mono = '9pt monospace'

c.hints.mode = 'number'

c.auto_save.session = True

# Numbers to tabs

config.bind('1', 'tab-focus 1')
config.bind('2', 'tab-focus 2')
config.bind('3', 'tab-focus 3')
config.bind('4', 'tab-focus 4')
config.bind('5', 'tab-focus 5')
config.bind('6', 'tab-focus 6')
config.bind('7', 'tab-focus 7')
config.bind('8', 'tab-focus 8')
config.bind('9', 'tab-focus 9')
config.bind('0', 'tab-focus 10')
config.bind('<Alt-1>', 'tab-focus 11')
config.bind('<Alt-2>', 'tab-focus 12')
config.bind('<Alt-3>', 'tab-focus 13')
config.bind('<Alt-4>', 'tab-focus 14')
config.bind('<Alt-5>', 'tab-focus 15')
config.bind('<Alt-6>', 'tab-focus 16')
config.bind('<Alt-7>', 'tab-focus 17')
config.bind('<Alt-8>', 'tab-focus 18')
config.bind('<Alt-9>', 'tab-focus 19')
config.bind('<Alt-0>', 'tab-focus -1')

config.bind('A', 'hint all tab-bg')

config.bind('a', 'set-cmd-text -s :open -t')

config.bind('e', 'open-editor')

config.bind('>', 'tab-move +')
config.bind('<', 'tab-move -')

config.bind('<Ctrl-P>', 'tab-pin;; tab-move 1')

pip install from github

Pip install from github is surprisingly easy: pip install git+

Day 308

Day 302

ML/Tensorflow logits meaning

Logits are the inputs to the softmax function:

the vector of raw (non-normalized) predictions that a classification model generates, which is ordinarily then passed to a normalization function. If the model is solving a multi-class classification problem, logits typically become an input to the softmax function. The softmax function then generates a vector of (normalized) probabilities with one value for each possible class.

ML attention animated

After all this time, I found this excellent animated example of attention and transformer and RNNs: Visualizing A Neural Machine Translation Model (Mechanics of Seq2seq Models With Attention) – Jay Alammar – Visualizing machine learning one concept at a time. From the same source, A Visual Intro to NumPy and Data Representation – Jay Alammar – Visualizing machine learning one concept at a time look very nice. I should resurrect my link wiki instead of pasting it all here.

Coding fonts


Interesting python syntax

Interesting Python syntax I’ve seen in the Transformer Google repo:

  • /= assignment operator, which is like +=.
  • X if Cond else Y:
stats = ({
        "loss": train_loss
    } if history is None else misc.build_stats(history, callbacks))
  • Can be also used in returns:
    return evaluate_and_log_bleu(
        self.predict_model, self.params, self.flags_obj.bleu_source,
        self.flags_obj.bleu_ref, self.flags_obj.vocab_file,
        self.distribution_strategy if self.use_tpu else None)

Kinda relevant is code golf - Tips for golfing in Python - Code Golf Stack Exchange.

Python rich comparison operators

object.__lt__(self, other)
object.__le__(self, other)
object.__eq__(self, other)
object.__ne__(self, other)
object.__gt__(self, other)
object.__ge__(self, other)
  • The correspondence between operator symbols and method names is as follows: x<y calls, x<=y calls x.le(y), x==y calls x.eq(y), x!=y calls, x>y calls, and x>=y calls


I should really create a vim thingy that automatically creates footnotes from a link. I can imagine it as a keystroke which generates a random footnote name and puts you on the last line of the file, with the footnote name prefilled, and in insert mode. Or another one that lets you specify a footnote name.

Day 296

apt-get purge and zsh

zsh does its own wildcard stuff, and apt-get purge nvidia* doesn’t work because of this. apt-get purge nvidia\* does (or with ‘’s). Same story as with scp, I’m surprised I keep having issues with this.

Linux see history of apt-get

Linux z-commands (zcat, zless, zgrep, zdiff)

Day 294

Day 290

English Pronunciation

Google has nice animations for this!

  • Query = [kwee ree]
  • Paradigm = [pa ruh daim] or American [peh ruh daim]

Linear algebra

I’ll be following this: 9.1. Attention Mechanism — Dive into Deep Learning 0.7 documentation

  • Inner product is the generalization of the dot product. Result is a scalar. 1

Python assert statement

UsingAssertionsEffectively - Python Wiki assert condition, message -> if condition is false, it returns an AssertionError.

Day 281


Most of this while I’m reading the “Attention is all you need” paper. The most important resources will be The Illustrated Transformer – Jay Alammar – Visualizing machine learning one concept at a time and 9.3. Transformer — Dive into Deep Learning 0.7 documentation.


  • BLEU is a metric of how good machine translation is.
  • Gentle Introduction to Transduction in Machine Learning

    Induction, deriving the function from the given data. Deduction, deriving the values of the given function for points of interest. Transduction, deriving the values of the unknown function for points of interest from the given data. Relationship between

  • Positional encoding in the Transformer is very well described at 9.3. Transformer — Dive into Deep Learning 0.7 documentation, with a visualization. Needed because there is no notion of the order of words in the architecture 1 We can’t do n=1..10 because sentences have different lengths, and word 3 out of 10 is not the same as 3 out of 3.
    • “The intuition here is that adding these values to the embeddings provides meaningful distances between the embedding vectors once they’re projected into Q/K/V vectors and during dot-product attention” 2
  • Subword algorithms are ways to represent words that use elements bigger than characters but lower than a word embedding, for example prefixes and suffixes, to better handle unseen words. Byte-pair and word-piece encodings are used by the Transformer.[^swa]
  • In essence, label smoothing will help your model to train around mislabeled data and consequently improve its robustness and performance. 3

[^swa] (3 subword algorithms help to improve your NLP model performance)



  • I should make a better Bash timer that counts till the end of the hour, so I don’t have to do this in my head
  • I should make a vim keybinding or script that automagically creates Markdown references. (I’d be surprised if this hasn’t been done)


Anaphora: * Repetition of something (rhetoric) * Pronouns and references to something already mentioned to avoid repetition (she, it, etc.)

Day 280

Pyplot / matplotlib creating multiple subplots

Creating multiple subplots using plt.subplot — Matplotlib 3.1.0 documentation

fig, (ax1, ax2) = plt.subplots(2)
fig.suptitle('Vertically stacked subplots')
ax1.plot(x, y)
ax2.plot(x, -y)

(or fig, (ax1, ax2) = plt.subplots(1, 2) if we want them side by side)

Pandas groupby plot without index

pandas.core.groupby.DataFrameGroupBy.plot — pandas 0.16.2 documentation has use_index, which decides if the values will be graphed using index as x (side-by-side) or one on top of the other.

Day 277

Python redirect stdout/output to file

This is really really neat!

def redirect_to_file(text):
    original = sys.stdout
    sys.stdout = open('/path/to/redirect.txt', 'w')
    print('This is your redirected text:')
    sys.stdout = original
    print('This string goes to stdout, NOT the file!')

(from Python 101: Redirecting stdout - The Mouse Vs. The Python)

Day 273

Unpack Java jars

Apparently java files are archives! Laut Extracting the Contents of a JAR File (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files) it’s jar xf jar-file [archived-file(s) to extract].

Pandas and numpy have different std/stdev standard deviation functions!

Both are correct, one divides by N, the other by N-1.

t df.std()==np.std(df, ddof=1). Somethingsomething delta degrees of freedom. ddof=0 can also be passed to pandas.

Day 271

Jekyll hide page from navigation

Out of all the ways I’ve found and described here, this is so far the cleanest one.

title: Some Title
layout: default
exclude: true

and then

 {% unless page.exclude %}
        <a class="page-link" href="{{ page.url | prepend: site.baseurl }}">
            {{ page.title }}
    {% endunless %}

Day 268

Work/play balance in i3 statusbar

Every productivity thought I’ve ever had, as concisely as possible - Alexey Guzey has been extremely inspiring. I added “work/play” to my statusbar, just for fun, with the following code to the statusbar wrapper script:

bashCommand2 = "date +%R" #returns %H:%M in 24h-format
bashOutput2 = subprocess.check_output(['bash','-c', bashCommand2]).decode('utf-8').strip('\n')

if hour in {9, 12, 15, 18, 21}:
    if minute>5 and minute<35:
    if minute<5 or (minute>30 and minute<35):

j.insert(0, {'full_text' : '%s' % wp, 'name' : 'wp'})

TODO – py3status

Stumbled upon Modules — py3status 3.20 documentation, and this looks like a much better alternative to the above. I’d need to move the python script in a separate file and that’s okay, everything else is absolutely wonderful.

Day 266


Had a long and wonderful vacation, and as it usually happens – I regret not keeping better records of what happened. In general, I feel like I’m losing some touch with my ability to write and to do at least semi-artistic things – and I believe this to be a great loss (for me, not for humanity).

Now playing: Музыка для никого - Агата Кристи (минус на пианино). Currently in the plane and without a connection, so untypically there will be no links.

During this trip home we organized another “we have a projector, make a ~20min presentation about whatever interests you” thing, and it went even better than the first – it’s not hard to get people to talk about stuff they are interested in. And it’s a wonderful way to get exposed to a lot of awesome stuff you didn’t know existed – topics ranged from vaccinations to roleplaying to how to play a flute.

Then I took part in my first D&D game, and it was interesting. Not going to get into it heavily, but it’s fascinating how everything is organized to be playable, and I think I see the appeal of it all. Also it looks 10/10 like something I would love – I’m not really sure why I don’t.

The month leading to it were probably one of the least pleasant of the last couple of years – thesis, very unpleasant uni stuff, a couple of all-nighters I could not properly recover from. My coscience was about as fragmented and stressed-out and burned-out as it gets, I think. So after 3 days at home the best thing happened:

Then I went to a 2 week camping thing in the Karpathians.

Now playing: Летов - все идет по плану

И взагалі мій куточок в Інтернет, маю право на що завгодно – продовження буде українською.

Так от, похід по Карпатах – це було настільки тотальне очищення дуже фрагментованої свідомості. Він був значно ващим ніж заплановано, і днів шість (а заплановано було три дні) треба було просто йти вперед. Навіть по-людськи не було часу годинку відпочити і понасолоджуватися на привалі. Плюс було трошки складно з маршрутом, один траверс який був набагато гірше маркованим у середині ніж його початок збив з дороги десь на день. І рюкзаки були значно важчі ніж було б правильно. І вилилось це все в просто 6 днів нервів але особливо тупо фізичного навантаження. І насправді це те, що, думаю, було особисто мені потрібно.

Now playing: Давайте делать паузы в словах

А, ще були гори, багато гір. Дивишся назад - бачиш прекрасний вид. Проходить 40 хв, знову дивишся - він став ще прекраснішим. І ти бачиш гори-гори-гори яких не бачив раніше. І розумієш, що це саме ти своїми ногами піднявся на цю висоту.

Але чи не основне те, що дав цей похід - це Н днів майже без телефону і без Інтернет у будь-якому вигляді. І найбільшу очистку дало саме це. (Окрема галочка – місця без телефонного звʼязку. Коли ти десь на горі, не бачив ніяких зустрічних туристів дня два, розумієш, що до найближчого місця де зможеш подзвонити йти годин 6.) І відчуваєш тоальну свободу, словами не передати яку. Свобода-пустота-ямогувсе, розумієш що для щастя тобі - конкретно тобі - треба небагато. Що проблеми - це шукати дрова, щоб не змерзнути. Прості древні проблеми. Розумієш, скільки умовностей і абстракцій ти собі постворював в т.н. “реальному” житті, і наскільки те, що відбувається тут з тобою на декілька порядків реальніше.

Відчуваю, що гублю ці увідомленя – навіть зараз, пару тижнів після кінця походу. І це теж у мене було - це все про свободу і т.п. не просвітлення після якого все інакше (я не впевнений, що взагалі вірю у такі просвітлення). Такі усвідомлення треба поновлювати, і речі/події які дають такого плану речі теж потрібно повторювати. Пригадую, що було у собору в Кьольні, що було коло Синевиру, що було під час минулих поїздок автостопом. Записувати це може трошки нагадати, але не дасть той самий afterglow котрий на шкірі і глибший за свідомість.

Now playing: Команда нашего двора - Визбор

Не останнім фактором, мені здається, там була тема чисто фізичних зусиль. Коли ти робиш 140% від того, на що (думаєш) здатен. Доходиш на вершину гори. Бачиш просто вау вид навколо, навіть не робиш спробу сфоткати - все рівно нічого не передати, і чимось це вже порожні для тебе категорії. Максимально стараєшся відчути, про-жити це. В тілі всі ті характерні ендорфіни від фізичної роботи, яка так очищає душу.

А на дворі 12 ранку, і ти розумієш, що тобі ще 2 таких подвига сьогодні. Звʼязку немає і не буде, телефон вимкнений, десь у тебе тренується якась нейромережа, але це так далеко і чимось не-реально. Згадуєш людей з твого реального життя, обличча ніби як зі сну.

І ще важливим було чітке розуміння того, що тобі навіть в чисто фізичному плані не так багато потрібно - в плані їжі, 39 душів в день, чистої голови. І хоча все рівно буду її мити, розуміння що 6 днів підряд можна цього не робити і все буде ОК теж робило все світлішим і простішим, чи що. Типу постворювали собі абстрактні системи і умовності, живемо в цьому гіперреальному світі, вирішуємо проблеми в рамках цієї системи - а так не завжди було і можна інакше. (Не в плані, що це погано, але швидше, що цікаво це бачити – бо контакт з простим і реальним втрачаєш тим більше, чим більше часу не маєш контакту з простим і реальним).

Now playing: Ostatnia prośba wędrownego grajka (та сама “Переведіть мене через майдан” польською).

Коли дійшли до цивілізації ми були раді бачити цивілізацію, все ж.

І друга частина відпочинку була ідеальною – лежали в кроватці, гарно їли у місцевій колибі, ходили до озера, потім поверталися, ad infinitum. Але телефона все одно не сильно включали. (Пригадую наскільки фізично дивно було друкувати щось на телефонній клавіатурі). В перший вечір зʼїли 10 блюд з колиби на двох.

Баноші, деруни з былими грибами, млинці з ягодами, ось це все.

I весь другий тиждень був тотальний-тотальний відпочинок, і фізичний і когнітивний. І цей формат дуже спрацював - і я його використовуватиму у майбутньому. Можливо, зі значно простішим походом, де на тебе не давить необхідність щось робити щосекунди, а просто релакс без телефона, з гамаками, вогнищем, і т.п.

У будь-якому випадку, Київ був гарним і я був дуже радим його бачити.

Повернувся додому, все було нормально. Галочка 1 - фраза “З дороги завжли треба помити руки і вмитися, щоб змити з себе пил і погляди людей”, і фраза друга-єврея одного street performer про те, що “людей нужно удивлять”.

Позже, вероятно, последует похожий постикак о планах на следующий год.

Over and out. (Y)

Day 252

Day 232

Bash kill running shell script

The %% tells the bash built-in kill that you want to send a signal (SIGTERM by default) to the most recently suspended background job in the current shell, not to a process-id.

Day 228

Markdown tables widths

Day 226

Day 224

scikit-learn vectorizer passing tokens

Day 219

Asciiquarium as screensaver with alock

Tensorflow variable scopes

The goal of variable scopes is to allow for modularization of subsets of parameters, such as those belonging to layers (e.g. when architecture of a layer is repeated, the same names can be used within each layer scope).


Day 214

Pandas remove duplicates efficiently (using only a subset of columns)


Markdown strikethrough uses two tildes

For this, markdown uses two tildes (like this).

(Should I write headers for these posts in /r/savedyouaclick style?)

Day 212

Delete files older than X days/hours via linux find

Also relevant is mtime, ctime, and atime - modification time, change time, access time.

mtime changes when you write to the file. It is the age of the data in the file. Whenever mtime changes, so does ctime. But ctime changes a few extra times. For example, it will change if you change the owner or the permissions on the file.

Tensorflow disable verbose logging; set environment variables before running script in Linux

TF_CPP_MIN_LOG_LEVEL=3 python3 does the magic needed

Qutebrowser open in new tab

Inserted the following in config.bind('a', 'set-cmd-text -s :open -t'), to make a an alias for O

Linux find parents of a process

This is really really neat when running shell scripts that run other shell scripts etc. ps fax gives a nice tree. Can be combined with other stuff, so ps faux also works. TODO actually read through the man pages about this.

Day 211

Python – how to run a Python script inside live shell

Or, from the same SO thread, one can do just import filename_without_extension, even if it doesn’t follow the structure with main() etc., in my experience.


Indexing and slicing multi-dimensional arrays or tensors in pandas, numpy, Tensorflo

This is probably one of the most SEO titles I’ve ever created, but I think it applies to all of them.

Tensorflow add one dimension (expand dims, expand_dims)

# 't' is a tensor of shape [2]
tf.shape(tf.expand_dims(t, 0))  # [1, 2]
tf.shape(tf.expand_dims(t, 1))  # [2, 1]
tf.shape(tf.expand_dims(t, -1))  # [2, 1]

Day 210

Linux screen scrolling

Day 204

Linux cal calendar alias

Finally cal is cal -m -w, which gives me Monday as starting date and shows the week numbers.

Week review pages script

Now names files after the week number, not the date.

FILE=./Week/$(date +%-U).markdown
DATE=$(date +%Y-%m-%d\ %H:%M:%S\ +0100)

“Clear screen and run command” zsh/bash alias

alias c="clear"
alias cc="clear; "

c remains, cc now clears the screen before next command is run. I noticed I’ve been doing this manually quite often, especially for todo stuff. Now cc s puts the output of s on the top of the terminal.

Wild random idea – since perspective on my screen, especially at the bottom of my screen, bothers me so much, could one make an eye-tracking thingy, calculate how much the screen output should be changed on x and y, and automatically do this, so that visually it looks like all the aspect ratios are preserved? Not sure how hard is this to implement, but either way I’m not touching this.

Day 198

Recording audio from speakers

This answer: sound - How to record output to speakers? - Ask Ubuntu mentions “Sound recorder”, and it works very well. Has weird settings about staying on top, running on startup etc that have to be changed.


Day 197

Bash scripting

Increment variable in bash an math in general

How to increment a variable in bash? - Ask Ubuntu var=$((var + 1)) is the most portable one.

Redirecting stdout and stderr in bash

some_command >file.log 2>&1 is the only one that works for me in all cases. (shell - Redirect stderr and stdout in Bash - Stack Overflow)

Bash arbitrary number of arguments and their number

"$@" are the arguments one can iterate through, and "@#" is their number.

Day 196

Set up vim keybindings in bash/zsh/… via inputrc

Use vi shortcuts in terminal | Vim Tips Wiki | FANDOM powered by Wikia – add

set editing-mode vi
set keymap vi-command

to ~/.inputrc or /etc/inputrc and restart terminal.

Day 193

zsh history

I can use !2332-style stuff inside commands as I type them! mycommand !23 if !23 is test would run as mycommand test.

IPFS (Interplanetary Filesystem)

IPFS is the Distributed Web – it looks very interesting, I should read the whitepaper or some basic intro (A Beginner’s Guide to IPFS –

Day 192

zip add to zipfile while ignoring directories

zip -j fileone filetwo ~/home/me/some/directory/file -j means “junk directory structure”

Day 191

Qutebrowser focus tab N keybindings

Now number keys focus tabs, as I had on Firefox:

config.bind('1', 'tab-focus 1')
config.bind('2', 'tab-focus 2')
config.bind('3', 'tab-focus 3')
config.bind('4', 'tab-focus 4')
config.bind('5', 'tab-focus 5')
config.bind('6', 'tab-focus 6')
config.bind('7', 'tab-focus 7')
config.bind('8', 'tab-focus 8')
config.bind('9', 'tab-focus 9')
config.bind('0', 'tab-focus 10')
config.bind('<Alt-1>', 'tab-focus 11')
config.bind('<Alt-2>', 'tab-focus 12')
config.bind('<Alt-3>', 'tab-focus 13')
config.bind('<Alt-4>', 'tab-focus 14')
config.bind('<Alt-5>', 'tab-focus 15')
config.bind('<Alt-6>', 'tab-focus 16')
config.bind('<Alt-7>', 'tab-focus 17')
config.bind('<Alt-8>', 'tab-focus 18')
config.bind('<Alt-9>', 'tab-focus 19')
config.bind('<Alt-0>', 'tab-focus -1')

Also found this really nice config file: maxx/dotfiles - .config/qutebrowser/ at c6611e7ef3ab93a712b8e37e784fed1b38fc1174 - Gitea: Git with a cup of tea

Tensorflow shapes [], [None], None or ()

() and [] are equivalent.

placeholder with [] shape takes a single scalar value directly. Placeholder with [None] shape takes a 1-dimensional array and placeholder with None shape can take in any value while computation takes place. (tensorflow - What is the difference between [], [None], None and () for the shape of a placeholder? - Stack Overflow)


less for continuous data

Except the command line flag I always forget for tail (tail -f some.log), less can do the same. After opening a file, pressing F/<Shift-f> puts you in the end and automatically updates if the file changes.


tee writes the output to a file while simultaneously showing it onscreen. Example from Linux tee Command Explained for Beginners (6 Examples) is ping | tee output.txt

scp to a non-standard port

scp -P 1337 from to:folder, it uses a capital P.

Day 186


tf.squeeze to remove dimensions of [1]

If I had a tensor of dimension [1, 2, 3], tf.squeze() would turn it into [2, 3]. tf.squeeze  |  TensorFlow Core r1.14  |  TensorFlow.

It removes any dimensions of shape 1 it finds. If I provide an axis parameter, it will only look at that dimension.


fixum – a fixed pay.
Elided - definition of elided by The Free Dictionary tr.v. e·lid·ed, e·lid·ing, e·lides

    a. To omit or slur over (a syllable, for example) in pronunciation.
    b. To strike out (something written).
    a. To eliminate or leave out of consideration.
    b. To cut short; abridge.

First seen as “[elided 10 identical lines from previous traceback]” in Tensorflow/Python

Learning Tensorflow

For a more systematic understanding: * jtoy/awesome-tensorflow: TensorFlow - A curated list of dedicated resources is a list of nice stuff, not necessarily meant to be read in the same order * astorfi/TensorFlow-Roadmap: Organized & Useful Resources about Deep Learning with TensorFlow has a more “more GIFs to the god of GIFs” feel to it, but is meant to be read in a sequential order, and the resources look very nice.

Day 184

pandas print_full to output stuff with max everything

def print_full(x):
    pd.set_option('display.max_rows', len(x))
    pd.set_option('display.max_columns', None)
    pd.set_option('display.width', 2000)
    pd.set_option('display.float_format', '{:20,.2f}'.format)
    pd.set_option('display.max_colwidth', -1)

(from SO)

Day 179

Day 178


Vim resize splits / vsplits

For a split window: You can use Ctrl-w + and Ctrl-w - to resize the height of the current window by a single row. For a vsplit window: You can use Ctrl-w > and Ctrl-w < to resize the width of the current window by a single column. Additionally, these key combinations accept a count prefix so that you can change the window size in larger steps. [e.g. Ctrl-w 10 +] (Resize splits more quickly | Vim Tips Wiki | FANDOM powered by Wikia)

Vim move tab

:tabm -1 moves it to the left; accepts absolute and relative parameters

Vim go back to previous buffer

(Especially handy if you’ve jumped to a global mark): <C-o>


Python __dict__ object

Linux Follies: Python’s __dict__

Each object has a .__dict__ attribute, which contains the objects’ fields. They can also be directly edited.


To read

Intro to tf.estimator and Good practices in Modern Tensorflow for NLP

Day 177



15.6. getopt — C-style parser for command line options — Python 2.7.16 documentation, especially the part optlist, args = getopt.getopt(args, 'abc:d:') – the options with a colon following need to have a value. Otherwise GetOptError will be raised.

Pandas Counter

Counter is much faster than count() in cases when you need to count multiple objects – you don’t have to iterate once for each object.

Jupyter notebook tqdm

Use from tqdm import tqdm_notebook as tqdm instead of usual vanilla tqdm.



vimdiff file1 file2 opens a nice vim session with two buffers. [c and ]c jump back and forward between changes. (See

Switch splits’ position in vim

<C-w> <C-r> just rotates all the splits, and <C-w> x to switch the current window with the next one. (split - Swap the position of two windows - Vi and Vim Stack Exchange)

Vim search history

:history / (Is there search and replace history in vim? - Vi and Vim Stack Exchange)

Day 176

Linux undelete file on ext filesystem with extundelete

extundelete /dev/sda4 --restore-file directory/file I’m shocked this works, and it can do a lot of interesting stuff - files, directories, list of deleted files, etc etc etc.

Day 175

Linux output logs continuously

I always forget this: tail -f /var/log/

Day 172



This is one of the best tutorials I’ve found. Todo: userscript that gives me back the real URL from

Tensorflow tensors and graphs


A tensor is a generalization of vectors and matrices to potentially higher dimensions. Internally, TensorFlow represents tensors as n-dimensional arrays of base datatypes.

A tf.Tensor object represents a partially defined computation that will eventually produce a value. tf.Tensors do not have values, they are just handles to elements in the computation graph.1

Rank	Math entity
0	Scalar (magnitude only)
1	Vector (magnitude and direction)
2	Matrix (table of numbers)
3	3-Tensor (cube of numbers)
n	n-Tensor (you get the idea)ank	Math entity
0	Scalar (magnitude only)
1	Vector (magnitude and direction)
2	Matrix (table of numbers)
3	3-Tensor (cube of numbers)
n	n-Tensor (you get the idea)


A computational graph is a series of TensorFlow operations arranged into a graph. The graph is composed of two types of objects.

  • tf.Operation (or “ops”): The nodes of the graph. Operations describe calculations that consume and produce tensors.
  • tf.Tensor: The edges in the graph. These represent the values that will flow through the graph. Most TensorFlow functions return tf.Tensors.


Python functools partial functions

functools.partial(func[,*args][, **keywords])\

Return a new partial object which when called will behave like func called with the positional arguments args and keyword arguments keywords. If more arguments are supplied to the call, they are appended to args. The partial() is used for partial function application which “freezes” some portion of a function’s arguments and/or keywords resulting in a new object with a simplified signature. For example, partial() can be used to create a callable that behaves like the int() function where the base argument defaults to two

Python lambda for hiding arguments

Same to above, also from Tensorflow: Here we wrap up our input_fn call in a lambda to capture the arguments while providing an input function that takes no arguments, as expected by the Estimator.

input_fn=lambda:iris_data.train_input_fn(train_x, train_y, args.batch_size)

Python argparse

A nice example from the estimator example in tensorflow:

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--batch_size', default=100, type=int, help='batch size')
parser.add_argument('--train_steps', default=1000, type=int,
                    help='number of training steps')

args = parser.parse_args(argv[1:])

input_fn=lambda:iris_data.train_input_fn(train_x, train_y, args.batch_size), steps=args.train_steps)

Pandas pop column

pandas.DataFrame.pop — pandas 0.24.2 documentation. Works like a list .pop, df.pop('columnname'). Especially handy for ML.


Qutebrowser userscripts

Created my first qutebrowser userscript!

echo "open$QUTE_URL" >> "$QUTE_FIFO"

Qutebrowser edit URL

go - set-cmd-text :open {url:pretty}. wO opens a new window.

youtube-dl and mpv play audio

mpv $url --vid no plays it as audio file.

tmux scroll up

<C-b> PgUp gives me copy mode.

amixer selecting an audiocard

They can be found in alsamixer. Then -c 2, where 2 is the device/card number.: amixer -c 2 set PCM 5%+

Day 171

Pandas apply() memory hell

This is a nice read about how Pandas’ apply needs to store the Series it creates, that there’s no magic, and that inelegant loops can sometimes be faster. Relevant is the official Enhancing performance guide, that I should read.

Day 169


  • Greed is absolutely wonderful and much more interesting than I thought at the beginning.

Day 168

Rclone and backing up Google Drive

rclone is nice. I followed the guide in Google drive, and the magic command to copy all content is rclone sync "drive:Google Photos" /mnt/data/Backups/GP, about 300kb/s, and about 4 hours left.

Day 165

Qutebrowser private windows

exist. qutebrowser --temp-basedir -s content.private_browsing true

IntelliJ Idea

  • Shift+Enter starts a new line without breaking the current one.
  • To focus the code with ideavim, the custom property suppress.focus.stealing=false worked.


Day 161


A Python config file is excellent. qutebrowser/configuring.asciidoc at master · qutebrowser/qutebrowser · GitHub For now this, then we’ll see:

config.bind(',l', 'set tabs.position left')
config.bind(',t', 'set tabs.position top')

config.bind(",j", "set content.javascript.enabled true")
config.bind(",J", "set content.javascript.enabled false")

config.bind(",t", "set multiple")
config.bind(",T", "set switching")
config.bind(",h", "set never")

c.url.searchengines = {'DEFAULT': '{}', 
        'g': '{}', 
        'c': '{}', 
        'd': '{}', 
        'd': '{}',
        'w': '{}',
        'y': '{}'

mono = '10pt monospace'
small_mono = '9pt monospace'

c.hints.mode = 'number'

«««< HEAD , All of the individual settings ======= All of the individual settings

  • 5 Whys - Wikipedia - “5 Whys is an iterative interrogative technique used to explore the cause-and-effect relationships underlying a particular problem.”

    The vehicle will not start. (the problem) Why? - The battery is dead. (First why) Why? - The alternator is not functioning. (Second why) Why? - The alternator belt has broken. (Third why) Why? - The alternator belt was well beyond its useful service life and not replaced. (Fourth why) Why? - The vehicle was not maintained according to the recommended service schedule. (Fifth why, a root cause)[2]


Day 160

Resizing/converting/… a video with ffmpeg

ffmpeg -i input.mkv -s 640x480 -c:a copy output.mp4

Jupyter/pandas show all columns / limit maximum number of columns to show

pandas.set_option('display.max_columns', None).

qutebrowser adding javascript bookmarklets

javascript bookmarklets/quickmarks · Issue #221 · qutebrowser/qutebrowser · GitHub

:bind ,insta jseval alert("Hello World")

Day 155

Using I/we/passive in a Bachelor’s thesis

No easy answer, but I liked here the joke “In your particular case, an inclusive we could be used to recognize the nematodes collaboration :) – Dr. belisarius May 10 ‘11 at 13:01”

  • I asked another young professor whether one could use “I” and she said “Only if you want to sound like an arrogant bastard”, and observed that only old people with established reputations can get away with it.

  • The passive voice should not be used to avoid writing I or we. If the entire thesis is written in the passive voice, it is much harder to read, and the sentences within it1 have to be reworded awkwardly so that some good transitions between the sentences within a paragraph are lost. On the other hand, if some sentences seem to require the passive voice, by all means those sentences should be written in the passive voice. But the passive voice should only be used where it is justified, that is, where its use improves readability of the thesis.

TL;DR use “we”, don’t use passive unless needed; don’t use “I” ever.

Also in Germany it’s bachelor’s thesis, apparently.

Bachelor’s thesis tenses

This is also really nice:

Past tense

Work done

We collected blood samples from . . . Consequently, astronomers decided to rename . . .

Work reported

Jankowsky reported a similar growth rate . . . In 2009, Chu published an alternative method to . . .


The mice in Group A developed, on average, twice as much . . . The conversion rate was close to 95% . . .

Present tense

General truths

Microbes in the human gut have a profound influence on . . . The Reynolds number provides a measure of . . .

Atemporal facts

This paper presents the results of . . . Section 3.1 explains the difference between . . . Behbood’s 1969 paper provides a framework for . . .

Future tense


In a follow-up experiment, we will study the role of . . . The influence of temperature will be the object of future research . . .

(As linked in the answer, taken from Effective Writing | Learn Science at Scitable.


qutebrowser yanking URLs and markdown

This is amazing. ym yanks the URL with the title, like this: word choice - Bachelor thesis or Bachelor’s thesis - English Language & Usage Stack Exchange.

qutebrowser passthrough mode

<C-v> enters passthrough mode, <Shift+Escape> to exit. It works very well with Jupyter-vim.

Thesis vim marks

m means what it always means, n is the place I’ve been working at the last time, d is the end of the thesis.


Day 152


  • Make finally a uniform and nice vim/bspwm/… keybinding system.
  • Learn vim formally, all movements and everything, and get rid of my “vim antipatterns”


Vim digraphs

:digraphs to see the available digraphs. <C-k>+%digraph% inserts it. For example, <C-k>+Pd → £

Vim movements

  • '. - move to last modified line.
  • D - delete everything until the end of the line.
  • C - change everything until the end of the line
  • U - undo all changes to this line
  • S - substitute everything inside this line
  • <C-a> - increment number at character
  • <C-x> - decrement number at character
  • F/f – move to prev/next occurrence of character
  • T/t – move to before prev/next occurrence of character

Learn to use my ;->: mapping

Day 151


“I’ve come up with a set of rules that describe our reactions to technologies: 1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works. 2. Anything that’s invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. 3. Anything invented after you’re thirty-five is against the natural order of things.” — Douglas Adams

“Be here now”

Aaaand from this Reddit thread:

  • “The mind is its own place, and in itself can make a heaven of hell, a hell of heaven.” From Milton’s ‘Paradise Lost’
  • “Don’t kill the person inside you who wants to be alive.” Every time I feel down and/or have suicidal thoughts, I think about the part of me who went through so much shit to get to this place. I don’t want to throw away the effort of that person.
  • Now I try and loosen up…moods come and moods go…I respect my feelings and those of others.
  • “My cat wouldn’t understand where i went.”
  • “If you’re going through hell, keep going.” - Winston Churchill
  • – My meds keep me goin, fuck a quote. – Yeah I was about to quote: “300mg buproprion” -Dr. Baker Fuckin inspirational!
  • “Bend, but don’t break.”
  • ” Fireflies love the dark too.”
  • “Only after disaster can we be resurrected. It’s only after you’ve lost everything that you’re free to do anything. Nothing is static, everything is evolving, everything is falling apart.”
  • None of these keeps me going. For me it’s curiosity and nothing else.
  • I think the saddest people always try their hardest to make people happy because they know what it’s like to feel absolutely worthless and they don’t want anyone else to feel like that. - Robin Williams
  • “Death doesn’t stop depression, it just spreads it to somebody else.”
  • “A smooth sea never made a skilled sailor” Franklin D. Roosevelt
  • ‘Get busy living or get busy dying’. From The Shawshank Redemption.

Day 150


vim-mediawiki-editor might make the links wiki fun again for me.


Jupyter/pandas output entire text in column without truncating

pd.set_option('display.max_colwidth', -1)

Pandas count occurrences of value inside a df row (and of values inside a list in a column)

I need to work on my descriptions. d['pos'] contains a list inside every row. I need to count the occurrences of a value inside this list. So I transform the list in a Series and then do value_counts, and each element of the list will be in its own column. The value of each column will be the number of occurrences.


I can do .fillna(0) at the end to put a 0 instead of NaN.

Though this feel awfully slow. (And why doesn’t simply .tolist work?)


Pandas latex code output

Apparently if text between two $s in the output of a command gets parsed like latex?


Michael Crichton invented the term Gell-Mann Amnesia as a reference to Nobel-winning physicist Murray Gell-Mann, who remarked that even though the newspapers were always wrong about his area of expertise (physics), he always found himself trusting them about everything else. (SSC)


0530_final_dataset.csv contains the final cleaned-up dataset with tokens, parts of speech, URIs/hashtags/mentions as their own POS, etc.

Zsh taskwarrior statusline indicator

Changed the statusline to the following:

function task_indicator {
    if [ `task +READY +OVERDUE count` -gt "0" ]  ; then
        #printf "%b" "\u$OVERDUE"
        printf "%b" "!!!"
    elif [ `task +READY +O count` -gt "0" ]  ; then
        #printf "%b" "\u$DUETODAY"
        printf "%b" "!!"
    elif [ `task +READY +A count` -gt "0" ]  ; then
        printf "%b" "!"
        printf "%b" "\u$OK"

Now in zsh the statusline gets changed based on the amount of important tasks still pending. More simple than what was before.

Day 149

Scratchpad with the DTB in bspwm

If it starts appearing on the wrong monitor, I can drag it to the right one, and its location will be remembered.

Repeat command with sudo in bash/zsh

sudo !!. This is awesome.

Pareto charts

TIL about Pareto charts, and they look very interesting. pareto chart

To take the example below, in order to lower the amount of late arrivals by 78%, it is sufficient to solve the first three issues.


are the next thing that will save my life, we’ll see if they stick.

Week review

Random / Psychology

Карта чуств is absolutely brilliant. Feelings

Day 148


  • I should create additional vim maps for a better way to access other registers. I should create at least one more p/y/yy/d/dd commandd set for them and keep them separatee from the main ones.
    • Or just let vim have it’s own copy/paste registers and make pasting the OS ones a special case


In college, I ran a painting business. Every painter I hired had to buy their own brushes. This was one of the first things I learned. Throwing a standard brush at new painters didn’t work. The “company” brushes were quickly neglected and degenerated into a state of disrepair. But painters who bought their own brushes took care of them. Painters who bought their own brushes learned to appreciate the difference between the professional $20 brush they owned and cheap disposable dollar store brushes. Having their own brush engendered a sense of enduring responsibility and craftsmanship. (from Codinghorror “The Programmer’s Bill of Rights)

rsync progress based on all files with pv

Allegedly there’s an official way, though I could not get it working: rsync -a --info=progress2 src dest What works is the second answer: rsync -aix /source remote:/dest | pv -les $(df -i /source | perl -ane 'print $F[2] if $F[5] =~ m:^/:') >/dev/null, and the general way rsync -ai /source remote:/dest | pv -les [number of files] >/dev/null.

To find number of files in general, ` find /source wc -l`.

Day 147


There are two sorts of comments - “What” comments and “Why” comments.

“What” comments tell you what the code is doing. In a lot of cases, depending on the language, the need for these can be reduced by writing clear code. This is much easier in, say, Python than Assembly. Even in Python though, sometimes you can be doing something a bit subtle where a 2 line comment can clear things up. These comments aren’t irreplaceable because with a bit of reading and work, you have all the information to work out what is happening.

“Why” comments are much more important - telling the reader WHY the code is doing whatever it is that it’s doing. The ‘trim()’ comment referenced in the article is a great example of a Why comment - all the reading around the code wouldn’t give you an explanation (although sometimes git blame will).

Many ‘what’ comments are superfluous, almost no ‘why’ comments are - they are the collective memory of design decisions that otherwise lives in people’s heads. (HN)

Linux sandboxing

For programs I don’t trust, Firejail seems okay. firejail <appname>.

Android ADB Push

Still works as I remembered it. adb push <sourcefile/s> <location>, where location in my case is storage/sdcard0 for the memory and storage/FD... for the sdcard. adb shell is very nice also.

Day 145

Technical writing errors

3 shell scripts to improve your writing, or “My Ph.D. advisor rewrote himself in bash.” is an excellent description of typical errors in technical writing. One of the pages I see that make me want to archive everything linked here and on the Link Wiki just in case it disappears. Also,

In that sense, peer reviewers are the guardians of the scientific community’s most limited resource: our collective attention span.


  • weasels="many|various|very|fairly|several|extremely\
    |mostly|largely|huge|tiny|((are|is) a number)\
  • passive voice
  • Duplicates


  • Should I add important quotes I want to read often in Anki instead of creating my own solution for basically the same thing?
  • Python built-ins worth learning

Language / German

  • 10-er – it’s like ‘sechziger’, ‘neunziger’ etc. - just never seen it. It works to say ‘десятки’ too (as opposed to ‘1-er’)
  • Vorkommastelle, nachkommastelle


Let the past die, kill it if you have to.

Day 144

Firefox Vimium switch to tab N

Added the following to the Vimium settings, now I can switch to tab N by pressing the respective number on the keyboard:

    map 1 firstTab count=1
    map 2 firstTab count=2
    map 3 firstTab count=3
    map 4 firstTab count=4
    map 5 firstTab count=5
    map 6 firstTab count=6
    map 7 firstTab count=7
    map 8 firstTab count=8
    map 9 firstTab count=9
    map 0 firstTab count=0
My entire Vimium config
# Insert your preferred key mappings here.

map L Vomnibar.activateEditUrl
map  l scrollLeft
map  h scrollRight

map  B goBack

map  o LinkHints.activateMode
map  a LinkHints.activateModeToOpenInNewTab
map  A LinkHints.activateModeWithQueue

map  <c-p> togglePinTab
map  <c-к> togglePinTab

map  , showHelp
map  о scrollDown
map  л scrollUp
map  р scrollLeft
map  д scrollRight
map  пп scrollToTop
map  П scrollToBottom
map  яР scrollToLeft
map  яД scrollToRight
map  <с-у> scrollDown
map  <с-н> scrollUp

map  в scrollPageDown
map  г scrollPageUp
map  к reload
map  пы toggleViewSource

map  ш enterInsertMode

map  Р goBack
map  Д goForward
map  пг goUp
map  пГ goToRoot

map  пш focusInput

map  а LinkHints.activateMode
map  А LinkHints.activateModeToOpenInNewTab
map  <a-а> LinkHints.activateModeWithQueue

map  . enterFindMode
map  т performFind
map  Т performBackwardsFind

map  хх goPrevious
map  ъъ goNext

map  нн copyCurrentUrl
map  на LinkHints.activateModeToCopyLinkUrl

map  з openCopiedUrlInCurrentTab
map  З openCopiedUrlInNewTab

map  Л nextTab
map  О previousTab
map  пе nextTab
map  пЕ previousTab
map  п0 firstTab
map  п; lastTab

map  ц moveTabToNewWindow
map  е createTab
map  не duplicateTab
map  ч removeTab
map  Ч restoreTab

map  щ Vomnibar.activate
map  Щ Vomnibar.activateInNewTab

map  Е Vomnibar.activateTabSelection

map  и Vomnibar.activateBookmarks
map  И Vomnibar.activateBookmarksInNewTab

map  па nextFrame

map  ь Marks.activateCreateMode
map  ё Marks.activateGotoMode

map  <a-з> togglePinTab

map  ББ moveTabLeft
map  ЮЮ moveTabRight

map  м enterVisualMode
map  М enterVisualLineMode
map 1 firstTab count=1
map 2 firstTab count=2
map 3 firstTab count=3
map 4 firstTab count=4
map 5 firstTab count=5
map 6 firstTab count=6
map 7 firstTab count=7
map 8 firstTab count=8
map 9 firstTab count=9
map 0 firstTab count=0

Vimium close pinned tab

With x, it’s nice, because my usual <C-w> doesn’t close pinned tabs and I have to unpin them to close them.

Markdown inserting images with caption

Apparently this is the officially right way to do it (see SO):

  <img src="" alt="my alt text"/>
  <figcaption>This is my caption text.</figcaption>

I changed it by adding the path in image.html, since apparently you can’t have curly brackets inside includes (I’m not sure how the SO answer works).

Since I may end up doing this often, I created a new include for dtb based on this answer:

<figure class="image">
    <img src="{{site.url}}{{site.baseurl}}/assets/{{ include.url }}" alt="{{ include.description }}">
  <figcaption>{{ include.description }}</figcaption>

to be used as

{% include image.html url="thesis/firstdata.png" description='Figure 1. Language of the collected tweets.' %}

On Linkedin there’s a nice description of what should the “related work” section look like.

Thesis mercator bounding boxes

In the notebook “Drawing_bb_on_merc_map” there are now a couple of functions that given the DublinCore coordinates output a mercator map with the rectangles highlighted.

h1 / h2 in Jekyll

Apparently you can’t use h1 in your own content: SO and overwriting /assets/css/minima.scss doesn’t seem to work for me. Я подумаю об этом завтра for now using ugly HTML with the post-title class hardcoded.

Day 141: LSDeluxe and Nerd Fonts

LSD and installing fonts in st and urxvt

LSD is a very nice replacement for ls. To set it up, I needed to download the individual fonts from Nerd fonts, cp-ing them to /usr/share/fonts, then running fc-cache -f -v.

To set up the new DejaVu font in urxvt, this is the line in .Xdefaults:

URxvt.font: xft:DejaVuSansMono Nerd Font Mono:pixelsize=12
URxvt.boldFont: xft:DejaVuSansMono Nerd Font Mono:pixelsize=12:weight=bold
URxvt.letterSpace: -1

And in st, config.h is:
static char *font = "DejaVuSansMono Nerd Font Mono:pixelsize=12:antialias=true:autohint=true";

AUR has a BIG nerd-fonts-complete package with all the fonts.

bspwm, polybar and multiple monitors

Following the advice in this article:

bspc monitor HDMI-0 -d 1 2 3
bspc monitor eDP -d 4 5 6 7 8 9 0 a b c

in bspwmrc, and

polybar example &
polybar big &

in, and

monitor = HDMI-0

used = %name%
label-occupied = %name% 
label-urgent = %name%!
label-empty = 

in polybar/config.

Also to make the tray appear only on the right monitor, I commented out ; tray-position = right on the HDMI monitor, now it appears again on eDP.

They work a bit different than i3 – the workspaces I list in each of the monitors in bspwmrc are accessed sequentially via the keyboard. That is, in the config above, f1..f4 get accessed with Mod+1..4, and Mod+5..x access the I..X ones. I think they get cycled from the left monitor to the right one, but definitely not in the order the monitors are set up in bspwmrc and not alphabetically.

bspwm config changes

Stolen mostly from dotfiles in this repo:

bspc config pointer_follows_monitor true # brings pointer to focused monitor (see workspaces)

and in polybar/config

label-empty =

Amongst other things – I’m not sure how to move my windows from the HDMI workspaces if I disconnect the second monitor from the computer, partly it means I’m (I think, for now) limited to a number of workspaces in each of the monitors. I’m not sure I miss the flexibility of this process in i3 - it might be a good opportunity to play with a much more structured number of workspaces. Maybe I don’t need the flexibility as much as I think.

bspwm/firefox go fullscreen (F11) but stay inside the bspwm window

full-screen-api.ignore-widgets in about:config (from here) is the best thing since sliced bread. I can F11 firefox, but it doesn’t occupy my entire monitor, just removes tabs/url/…, and I can still use Tree tabs. It’s very close to what I used to do with pentadactyl. This is freaking awesome.

pikaur full system upgrade

Works the same way as with pacman. Interesting that I never thought about this. sudo pikaur -Syu

redshift change day/night temperature

Updated to use redshift with a warmer nighttime temperature: redshift -l 51.34:12.38 -t 6500:3000

Also I’m not sure I like the use -l both for location provider and lat/long info. I think I understand the logic, but still..


  • Add spoilers to Jekyll.
  • Check again laptop-mode
  • In general document all my settings well in one place.



If you never heal from what hurt you, you’ll bleed on people who didn’t cut you

Spoilers in HTML and now Markdown (kramdown)!


# I need to add

to all HTML tags where I want to write markdown. This one is inside a child without the setting.
print("hello world!")
Got this from here

I am a child with the markdown setting within a child with a markdown setting

I should look into markdown options which would allow me to do more flexible CSS – and I could create a vim mapping to make them quick.

Day 139

Bash dtb script

Updated the script to create a markdown dtb file to the following:

FILE=_posts/$(date +%Y-%m-%d)-day$(date +%j).markdown
DATE=$(date +%Y-%m-%d\ %H:%M:%S\ +0100)

if test -f "$FILE"; then
        vim $FILE
        exit 1

echo "Creating file $FILE"
touch $FILE
echo "Adding stuff"

/bin/cat <<EOM >> $FILE
layout: post
title:  "Day $(date +%j)"
date:   $DATE
categories: []


vim $FILE

Now it’s closer to and doesn’t overwrite anything if run again by error, doesn’t add any unused parts, and opens the file if it exists already.

Bash check if file exists

if test -f "$FILE"; then
        vim $FILE
        exit 1

Bash exit script

exit 1 or whatever status code.

Bash suppress output of command (bash redirection)


command > /dev/null 2>&1 redirects both stdout and stderr to /dev/null;

command &> /dev/null & works for me too, though it may not work in all shells. command > /dev/null still shows errors.

Progress notes

Added to anki everything until this page on the pro git ebook

Day 138: bspwm and some configs

After another small pause, here comes another längliches post!

Urxvt -name and settings

I had been trying to get urxvt to play with i3 scratchpads, but when I set the -name setting I got a vanilla URxvt look.

You evidently configured the font for a specific application instance rather than for an application class. (SO). To make your settings always apply, set URxvt.font rather than urxvt.font, etc.

Solved my problem.

Though at the end, I spent some time looking for a way to grep “name” instead of “class” for URxvt in bspwm and gave up, now typing this on a st terminal and loving every second of it!


Is the terminal I might start to use everywhere.

In config.h I changed the font to be static char *font = "DejaVu Sans Mono:pixelsize=12:antialias=true:autohint=true";


Decided to give it a try, loving it!


To implement the scratchbox, used the method described in the Arch wiki.

In bspwmrc,

t -c scratchterm &
bspc rule -a scratchterm sticky=on state=floating hidden=on

In sxhkdrc,

super + minus

In ~/s/scratch,

#!/usr/bin/env bash
id=$(xdotool search --class scratchterm | head -n 1)
echo $id

if [ "$id" != "" ]
       bspc node "$id" --flag hidden -f

I added |head -n 1 so it can better deal with possible multiple terminals of this class, in case I have to restart bspwm for whatever reason.


  • The hype cycle of working memory training
    • near transfer is much more likely and proven than far transfer
    • in general doesn’t look to optimistic
    • High IQ/WM people benefit the most
    • High spacing seems the best for transfer
      • might be related to all those other “pauses are good you learning” effects
  • Spectrometer using a CD
  • ‘I’ve become very isolated’: the aftermath of near-doomed QF72
    • Like a bad partner, the computer’s systems went crazy then stopped communicating with me.

    • I’ve become very isolated. When you’ve been to the Moon, you can only talk to astronauts.

  • The Copenhagen interpretation of ethics
    • Excellent.
    • The Copenhagen Interpretation of Ethics says that when you observe or interact with a problem in any way, you can be blamed for it. At the very least, you are to blame for not doing more.

    • The program was helping as many people as it could, the only change was explicitly labeling a number of people it wasn’t helping as a “control group”. The response?
      “They should immediately stop this experiment, ” said the Manhattan borough president, Scott M. Stringer. “The city shouldn’t be making guinea pigs out of its most vulnerable.”

Arch compiling AURs from source

Didn’t have to do this a long time:

  1. makepkg -Acs
  2. sudo pacman -U x.pkg.tar.xz

Day 133


  • Formalize my Sprint reviews.
  • Three works a week of PI – how do I actually keep track of this? I need an infrastructure.


Block-level attributes in Jekyll/kramdown/markdown

This describes amongth other things block-level stuff for Markdown. This is potentially a solution for different footnotes and various other small design tweak I’d like to have on this blog. I can just add a CSS class and then in CSS see what I want to do with it.

Git diff a file between revisions

git diff HEAD^^ HEAD – where HEAD^^ is “two revisions back”. Also the option --compact-summary gives number of insertions and deletions.

Anki steps

It’s an interesting thing to research someday. This discussion and similar ones can be a reference, along with looking at the graphs and targeting 80% retention.

In general I really should invest an hour or so to learn everything about Anki, so far it’s been the single most effective tool I have for my memory but am using it on a default and primitive level.

For now I changed Steps to “1 10 60” and “10 60”, new interval to 30%.

To print for The Road

    • till page 123 or so

Day 131


  • Remember that Eisenhower Matrix is a thing and that it used to help me quite a lot before.
  • I should formalize all the checklists I created for myself and use them.
  • Look into Energy Management vs Time management
    • etc.


  • A | character doen’t play nice with bullet point lists (*) - why?
    • Seems to be related to tables

Timewarrior “multitasking”

You can’t do simultaneous stuff, but you can have simultaneous test. From SO:

    timew start MONITORING PROJECT1 # monitoring all day, starting with project 1
    timew start MONITORING PROJECT1 PROJECT2 # adding project 2 to the pool
    timew stop PROJECT1 # done with project 1, still monitoring and working at project 2
    timew start MONITORING PROJECT2 PROJECT3 # adding project 3
    ... # something similar with PROJECT4 and PROJECT5
    timew stop # done for today

To read

The Nitrous Oxide Philosopher



“Think in the morning, act in the noon, read in the evening, and sleep at night.” Blake

Day 127


Chrony would solve most of my NTP problems.

Latex absolute positioning of images


(from SO)

Adding LaTeX to Jekyll/Markdown/Webpages via Mathjax

This is freaking amazing.

Mathjax. For inline math:

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});

This gets added to whatever template in Jekyll, usually _layouts/post.html. Used this in my MPT notes. Where was this my first 6 years of uni?


Latex multiple pictures on one page

        %\caption{Picture 1}
        %\caption{Picture 2}

\vspace{8 mm}

        %\caption{Picture 1}
        \caption{Picture 2}

… I feel the above is wrong on many levels, but I’ll leave this here. I need to research better pictures with different sizes and floats. Or just read a book about latex from A to Z

Vim comments plugin

Nerdcommenter. To comment: <leader>cc. <leader>cn for forced nesting. To toggle: <leader>c<space>.

If the topmost selected line is commented, all selected lines are uncommented and vice versa. <leader>cA goes to end of the line, inserts a comment and goes into insert mode.

Latex % character at the end of the line

A % allows you to go to a newline without adding a space.

Zathura side-by-side view

Side-by-side view is toggled by d. Also set first-page-column 1:1 changes which page gets shown first.

LaTeX page width

\paperwidth, not “pagewidth”.

Day 126


“Buy the farm” in North American slang for dying.

When a military pilot with a stricken airplane attempted to crash land in a farmer’s field, he would destroy a portion of the farmer’s crops for which the US government paid reimbursement to the farmer. If it were a bad crash-landing destroying most of the crops then the crash would cause the buying of the whole farm

Firefox resistfingerpringing setting

The flags privacy.resistfingerprinting.* in about:config. Let’s test this and see what happens.

Presentations format

Clear is better than clever uses a nice way to publish a presentation: slide on top and any test notes on the bottom. Never seen that before and it’s nice.


Kernighan’s layer

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it? Main points:

  • Implement below your ability, and you get to debug in the “flow” area.
  • Implement at your ability, and the debugging will be frustrating, but you gain skill.


stop starting and start finishing (HN)

Day 124

Swagger API documentation


CURL debugging REST (with GET, PUT, etc)

curl -X PUT -F file=@/home/sh/nl http://localhost:8080/files/nll

curl -X DELETE http://localhost:8080/files/nl

curl -F file=@/home/sh/nl http://localhost:8080/files/ 
(or to be precise)
curl -X POST -F file=@/home/sh/T http://localhost:8080/files/

Data is sent with -d "id=value"

Spring testing

My future client

Firefox extension bug and choosing a profile

firefox --ProfileManager opens the profile dialog.

Git add (git add * vs git add -A vs git add .)


  • git add -A stages all changes
  • git add . stages new files and modifications, without deletions
  • git add -u stages modifications and deletions, without new files

(from SO)



Day 123

API Design

API Documentation

An example of how to document one

Uploading files (“Why multipart mostly sucks”)

nice, esp. their description of youtube’s resumable upload.

Java Spring @Services

This is a tutorial where they move the business logic to a @Service, which is another nice example. Also I have not seen .htm in a long time.

Test a REST API with curl

The tutorial

 curl -F file=@/home/sh/nl http://localhost:8080/upload
 curl -v localhost:8080/download/file

Curl examples is even better.
` curl -i -X POST http://localhost:8080/delete -d ‘filename=test’\\ Everything after -d` is data.

Exception handling in Sprint

A number of methods described well

Springboot install

via sdkman: sdk install springboot


pinta is a nice simple image editor for linux.

Recording terminals with asciinema

asciinema rec to start recording, Ctrl-D or exit to stop recording. It’s really really neat!

Day 115

The internet is wonderful


Vim has a default escape keymap

Ctrl-[. This is better than my qj configured one actually.

Day 114


Feature importance

Inspecting the importance of features when running Random Forest:

feature_importances = pd.DataFrame(rf.feature_importances_,
                                   index = X_train.columns,
                                    columns=['importance']).sort_values('importance',                                                                 ascending=False)

pandas shuffle

df.shuffle(frac=1) uses the shuffle function for this.


  • for illustration purposes and with no loss of generality, ..

    Order after groupby()

    It’s kinda logical, but if I group stuff, it gets saved in the same order.

Day 112


Subfigures / subfloats, pictures side by side

        \caption{Picture 1}
        \caption{Picture 2}

DNB and typing

505 cpm 98.8%
535 cpm 98.1%


“When I look into the future, it’s so bright it burns my eyes.” — Oprah Winfrey (as quoted here)


This HN thread has an interesting consensus that Colemak > Dvorak. Also:

I firmly believe that any differences or gain that people attribute to Dvorak is attributed to finally learning how to properly type.



I need a plan. Which I will formulate later today. Meanwhile, any of the papers by Volkova seem very relevant to what I’m trying to do. Though I think after a number of them I’m not getting any additional value from them. We’ll see.

Papers will be numbered in green colour with numbers [1], parts in the paper will be numbered in green in a circle and marked (1).

Main points

  • Shorter texts are harder to analyze – try to download more tweets from the users? And mix them to remove style.
  • Grammar checks and replacements are fascinating to do and analyze, do them
  • Baseline for accuracy
  • Download and look at the reddit dataset


NLI with User-generated Content [1]

Main points
  • The dataset and the L2 project of the Uni of Haifa
  • It has interesting baselines which I can use in my thesis as example..
  • (1) is an example why geography =! language
  • Filtering data from multi-language countries.
  • They have 230 million sentences, much more than I do. Is this the number of examples I need?
  • n-grams etc are very context/dependent, what I mean with TW and political stuff happening. They should yield high acc on training set but generalize poorly.
  • Spelling and grammar
    • original word and correction offered by spell checker
    • Grammar checked by LanguageTool (2)
  • Frequencies of function words
  • Trivial baseline for classification tasks
  • Nice table of how much the features were relevant, p.3596 (3)
  • "”the personal style of whe user may dominate thesubtler signal of his or her native language”
  • Substitutions as suggested by spell checker should be fascinating.
  • Shorter texts are much harder (6)
  • Download tweets by the same users to get a bigger corpus of things I can compare them from. Or, to protect myself from the influence of stylistics, just get many many more tweets.
    • If it goes bad – just categorize users with Twitter meta-data as features, and by downloading their last X tweets in a certain language.
  • Much easier to do native/nonnative and language family than language
    Interesting language:
  • To the best of my knowledge,
  • Related but different
  • accurate, albeit not perfect, proxy for the NL of the author.
  • Reasonably robust to

NATLID: Native language identification [2]

  • g authorship profiles
  • NLI is challenging even for humans.
  • in a CNN smaller (2-3) filter sizes work better (3)
  • Ensemble model, with a voting scheme proportionate to the acc of the models (4)
  • Spoken responses are easier to NLI because the written ones are supposed to be more formal and thought-out.
    • Which might be a win-win for my Twitter data. Should be much less thought out than essays, and much more of the L1 should “shine” through them!
  • Highest misclassification between close languages. - This is why I added BR to MX.
  • g arc length, downtoners and intensifiers, production rules, subject agreement – as features. (2)

A brief survey of text mining: Classification, clustering and Extraction techinques [3]

  • hard vs soft classification: hard is when you get a result, soft is where you get a probability for result.
    • SVM do hard classification, but you can modify them to give a probability
  • Naive Bayes works for independent input variables..
  • SVM rarely need feature engineering because it selects support vectors itself. It’s robust to high dimensionality. Text classif. is mostly sparse data - a really okay use case for SVMs. (3) is a description of why SVM work so well for NLI.
  • (4) “Text representation has a very large dimensionality, but the underlying