Add warning and tip macros to TiddlyWiki

I am a *very* big fan of TiddlyWiki. I use it to document just about anything I figure out while working on projects, setting up systems, … Anything I would otherwise quickly forget. It makes it easier to add structure to random tidbits of information, and forcing myself to document while I work on something helps to stay focused on a certain goal.

I noticed some of the “official documentation” Tiddlers had options to emphasize tips and (more importantly) warnings, such as these:

While there seems to be an endless list of special tricks one can do with a TiddlyWiki, this was something that seemed really useful so I decided I needed to find out how to recreate them…

Add the macros and stylesheets

In the examples below, replace “Deevee” with any other folder name where you want to gather your own custom macros and stylesheets…

  • Create a new tiddler, name it $:/Deevee/macros
  • Add the tag $:/tags/Macro
  • Past in the following contents:
\define .tip(_) <div class="doc-icon-block"><div class="doc-block-icon">{{$:/core/images/tip}}</div>$_$</div> 
\define .warning(_) <div class="doc-icon-block"><div class="doc-block-icon">{{$:/core/images/warning}}</div>$_$</div>
  • Create another tiddler, name it $:/Deevee/styles
  • add the tag $:/tags/Stylesheet
  • paste in the following contents:
.doc-icon-block {
	border-left: 2px solid <<colour code-border>>;
	margin-left: 3em;
	padding-left: 0.6em;
	position: relative;

.doc-block-icon {
	position: absolute;
	left: -3em;
	top: 0.2em;

Using the macros

Simply use:

<<.tip “your text”>>

<<.warning “your text”>>

Setting up Visual Studio Code for Python development (on Linux)

The following is a brief guide to reinstalling/setting up Visual Studio Code (VSC) on a new Linux system. The main use is Python development. As such, it is very brief and mostly for my own documentation.

Install VSC

sudo snap install --classic code

Install Python packages


  • linting (flake8): python -m pip install pyflakes pycodestyle mccabe flake8
  • Refactoring (rope): python -m pip install rope
  • Formatting (Yapf): python -m pip install yapf
  • Type checking (mypy): python -m pip install -U mypy --user
  • Flake8 Bugbear: python -m pip install flake8-bugbear, then check if installed with flake8 --version (should include flake8-bugbear)
  • Sphinx/RST support: python -m pip install doc8 rstcheck sphinx-autobuild
  • Snooty languageserver: python -m pip install snooty-lextudio

Install and configure plugins

Select interpreter


"python.pythonPath": "/usr/bin/python3",

to $HOME/.config/Code/User/settings.json

Set up linting

List of possible linters and how to configure them

Open user settings and

  • set Python > linting: flake8 path, to C:\Python39\Scripts\flake8.exe
  • Add max-line-length=99 to Python > Linting: Flake8 Args
  • Enable flake8

or add

    "python.linting.flake8Path": "C:\\Python39\\Scripts\\flake8.exe",
    "python.linting.flake8Args": [
    "python.linting.flake8Enabled": true,

to %APPDATA%\Code\User\settings.json (Windows) or $HOME/.config/Code/User/settings.json (Linux)


  • Install package

python -m pip install -U mypy --user

  • Enable
    "python.linting.mypyEnabled": true,
    "python.linting.mypyArgs": [],
    "python.analysis.typeCheckingMode" :"basic",
    "python.linting.mypyPath": "C:\\Users\\dieterv\\AppData\\Roaming\\Python\\Python39\\Scripts\\mypy.exe",

to ~/.config/Code/User/settings.json

more mypy info


Add the following to your settings.json

"autoDocstring.docstringFormat": "google",
"autoDocstring.guessTypes": true,
"autoDocstring.generateDocstringOnEnter": true,
"autoDocstring.includeExtendedSummary": true,
"autoDocstring.quoteStyle": "\"\"\"",

Home Server – setting up ZFS (revisited)

Finally, after two years of renovations and two children, I am revisiting the idea of a small home server. I don’t expect it to do much:

  • Media server
  • File backup
  • Some docker containers
  • Grafana
  • Possibly pfSense or another firewall

Whenever I’m accessing a remote system (even when using SSH in my internal network) I prefer to start a TMUX session. That way, if I get disconnected (for instance) during the middle of a package upgrade, that process just continues and I can reconnect at a later time without issues (if tmux is not yet installed or you’re not using it yet, I highly recommend reading up on it and taking a bit of time to get used to the basic concepts. I used this quickstart a couple of years ago).

tmux new -s sessionname

Install the required zfs package:

sudo apt update && sudo apt install zfsutils-linux

Then find out which drives you want to use:

sudo fdisk -l

In my case, I wanted to use the two 1.8GB drives (/dev/sdb and /dev/sdc) in a mirror configuration. I don’t have a hundred movies to fill a drive, most space will be taken up by photos and system images.

sudo zpool create mypool mirror /dev/sdb /dev/sdc

Check the pool status to verify that it is as intended:

zpool status

The pool automatically gets mounted on /mypool with root:root as owner. I changed the owner/group to my own user

sudo chown <user>:<user> /mypool/ (replace <user>)

Using MicroPython (PyBoard V1.1) with Visual Studio Code


This still isn’t working as I think it should. Especially the linting and autocomplete still doesn’t work (leaving only the PyMakr module which works partly, in fact). For example: “import pyb” still does not add autocompletion when typing something like “s = pyb.<CTRL + SPACE>”. Most likely this is because I used a combinations of tools that shouldn’t be used together. Need to spend more time on this…


I’ve recently started using a PyBoard for a project that I am working on. Writing code in an IDE, saving the files, then manually copying them to the board to test them gets tedious rather quickly. If you’re using Visual Studio Code, there are options to do almost everything from within the IDE itself. Getting things to work as they should took a bit of effort and headscratching. What I needed to do is documented below.
Links to the sources of my information is at the bottom.

Install libraries/addon

  • pip install --upgrade pip --user
  • pip install --upgrade micropy-cli --user
  • pip install micropy-cli[create_stubs]
  • pip install rshell --upgrade
  • To prevent “Source directory /pyboard/stubs does not exist.” after creation open, change line 63 from
    pyb_path = f"{self.pyb_root}{_path}"
    pyb_path = f"/flash/{_path}"

and save the file.

  • Inside VSC, install the Pymakr plugin
  • Install node.js (see link below, and reboot afterwards)

Create the stub yourself…

(This did not work properly for me. See below for another option.)

  • Connect the PyBoard over USB
  • Find out the serial port number (represented from here on by comXX)
  • Run
    micropy stubs create comXX

    (replace XX by com port number) -> this takes a couple of minutes

  • the result will be copied to ~/.micropy/stubs (in my case in a sub directory “pyboard-1.13.0”

…Or get them from someone else

I got mine from Josverl on Github. See his for more information as well.

  • Pick a directory that will hold the files. Clone the repo:
    git clone
  • create a symlink in your project folder:

    mklink /d all-stubs <directory holding the stubs>
  • create a settings.json file in your project folder containing (change the references to the stubs you need, in the desired order):
    "python.linting.enabled": true,
    "python.linting.pylintEnabled": true,
    "python.languageServer": "Microsoft",
    "python.jediEnabled": false,
    "python.autoComplete.extraPaths": [
     "python.autoComplete.typeshedPaths": [
     "python.analysis.typeshedPaths": [
  • Copy the .pylintrc file from the sample folder and adapt the init-hook line to reflect the chosen folders (in last step):
init-hook='import sys;sys.path[1:1] = ["all-stubs/cpython_core", "all-stubs/pyboard_1_13_95", "all-stubs/mpy_1_13-nightly_frozen/GENERIC", "all-stubs/cpython_pyboard",];'
  • Restart VSC:
Developer: Reload Window

Set up your project (in VSC terminal, with project open)

  • To check that your stub (config file for your board) has been installed run
    micropy stubs list 
  • If not, run
    micropy stubs add <path to stub> 

    (where the path is the directory that contains the info.json file.)

  • run
    micropy init <project name>
  • Select what to generate (‘a’ selects all)
  • select which stub to use (the one you just created)
  • A subdirectory will created with <project name> you just specified
  • Open the pymakr.conf file in the subdirectory <project name>. Change

    to your comXX. To do this system wide for Pymakr, open the command palette (CTRL+SHIFT+P) and select/type “Pymakr > Global settings”

  • In the same config file, I had to set “auto_connect”: false to resolve some vague
    "> Failed to connect (Error: Port is not open). Click here to try again." 

    errors when connecting to the board. Setting this to “true” the following behavior: “ignores any ‘address’ setting and automatically connects to the top item in the serial port list”

  • See here for more explanation on the other options

Using the combination

  • To add package dependencies to your project:
    micropy install <PACKAGE_NAMES>
  • Functionality in the Pymakr addon can be used by opening the command palette (CTRL+SHIFT+P) and typing Pymakr. There are options to (dis)connect, run the current file, up/download the whole project, get the FW version,…
  • Note the new terminal “Pymakr Console”:
    Pymakr console
  • And the “Pymakr toolbar”:
    Pymakr toolbar

Shortcuts (from the Pymakr addon info)

ctrl-shift-c : (Re)connect
ctrl-shift-g : Global settings
ctrl-shift-s : Synchronize project
ctrl-shift-r : Run current file
ctrl-shift-enter : Run current Line


Installing OpenVPN on Ubuntu 12.04

The company I have been working for for a couple of months has an OpenVPN server running. Recently I wanted to install the client software on my Windows 7 desktop and my Linux laptop.

Our IT guy kindly supplied me with a executable to install and configure the client under Windows and a config file and certificates for Linux.

Windows 7 worked immediately but under Linux I had to do some extra steps to get it working properly. I’ll document them here for future reference and maybe other people running in to the same issues.

I had previously installed OpenVPN under linux and hoped the config file would be all I needed. When running

openvpn –config configfile.ovpn

I got the error message:

Options error: Unrecognized option or missing  parameter(s) in configfile.ovpn:11: verify-x509-name (2.2.1)
Use –help for more information.

Some digging around showed the “verify-x509-name” command was implemented starting at OpenVPN version 2.3. Using

apt-get install openvpn

and the default repositories in Ubuntu the installed version was 2.2.1

To get the latest version, I uninstalled the current installed version using

apt-get purge openvpn

then downloaded and untarred the latest version from the community downloads (at this time 2.3.6)


tar -zxvf ./openvpn-2.3.6.tar.gz

Installing should work this way:

cd ./openvpn-2.3.6

./config && sudo make && sudo make install

but I ran into dependency problems. Some error messages came up regarding the LZO package.

configure: error: lzo enabled but missing

I found this page by Droidzone describing the dependencies and some useful information on how to find missing dependencies during future installs. Worth a read.

In short:

sudo apt-get install libssl-dev liblzo2-dev libpam0g-dev

will install the necessary dependencies. After this the installation went fine:

openvpn –version

OpenVPN 2.3.2 x86_64-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [eurephia] [MH] [IPv6] built on Dec 24 2014

Wake-on-lan (WOL) bash script on router running dd-wrt

After setting up my router to run dd-wrt I’ve used PuTTy to ssh into the router to start my desktop machine to work on it through a RDP session.

After spending months looking up the correct MAC address in my phone and typing the commands by hand I finally took a bit of time to write a small bash script on the router so that I could simply run the script each time I needed it.

On my router (WRT54GL) there’s a bit of space in the /jffs folder that’s usable for storing scripts.

To write a script named “wol” go to the correct directory and type:

vi wol

VI opens in command mode. To start editing press the INSERT key. At the bottom left of the screen a “I” will be displayed. The editor is now in editing mode. I just wrote:


echo “Waking up 19\” system”

/usr/sbin/wol -i -p 9 xx:xx:xx:xx:xx:xx

echo “Done”

Where xx:xx:xx:xx:xx:xx is the MAC address of my network card.

To get back in command mode press ESCAPE.

Then to save the file and exit type:

:wq and ENTER. (the semicolon starts the command, wq stands for write and quit).

This creates the script, the only thing left is to make is executable:

chmod 700 wol

From now on, the script can be started by going to the correct directory and typing:


The script will be called and run the commands. If there are any error messages they will be displayed.

Ubuntu Server – setting up ZFS (part 1)

For a while I’ve wanted to learn about Linux, the way the OS works, what can be done with it, if it’s reasonable to change to it as my main operating system.

As well as dual booting Windows 7 and Ubuntu 12.04 on my laptop I thought I should try and set up my home server running a Linux distro. This way I’d be forced to learn my way around the command line, setting up a system to run smoothly without the need for much maintenance.

The things I wanted to try to set up were:

  • Some sort of NAS, with the option of mounting it as a samba drive over my internal network and using some sort of FTP that has to be secure when accessing the shares from outside of my home network.
  • I really want to give Owncloud a try. Not just as an alternative to Dropbox, but also as a central calendar and contact database. Over WebDAV that should be possible. I’ll have to get a basic Apache setup running to do this.
  • I’d like to try out the ZFS file system as I have no previous experience with it.
  • To have an openVPN server running at home would be nice when working abroad for longer periods of time (tunneling email, accessing home network, …)
  • Maybe a Socks proxy (?)
  • Keeping it all secure

As I have some experience with Ubuntu desktop I picked Ubuntu Server to start with. As I go along setting up the system I might end up deciding to pick something else and start over, but as I take this as a learning experience that’s fine.

So I started downloading the Ubuntu Server 12.04 AMD64 iso and made a bootable USB stick to install the system.

During the installation I didn’t change much from the standard settings. I partitioned the disk before installing the OS but nothing else. As I knew I was going to need the Apache and MySQL packages for Owncloud I picked the LAMP bundle for installation as well.

After installation one of the first things to do was to get a zfs pool up and running. I had picked two Western Digital RED series 2 TB disks as my data disks as they are made to be running for extended periods of time and one Seagate Spinpoint 320 GB 2.5″ drive for the OS and swap. This should give me a good balance between power and storage. The 2.5″ will be set up to go into idle really quick to save power.

Installing Ubuntu ZFS

To install the ubuntu-zfs package the ppa:zfs-native/stable repository needs tot be added to the system.

Apparently the add-apt-repository command wasn’t installed yet on the 64 bit version on my system. There are two options:

  1. Install the python-software-properties package
  2. manually add the repositories to /etc/apt/sources.list

As I will need to add more ppa’s later on I chose the first option.

A quick sudo apt-get install ubuntu-zfs and some 170 Meg later the package was build and installed.

Creating a ZFS pool

sudo parted followed by print devices displays a list of devices with their storage capacity:

(parted) print devices
/dev/sda (320GB)
/dev/sdb (2000GB)
/dev/sdc (2000GB)

/dev/sdb and /dev/sdc are my two disks that will be used for a mirrored ZFS pool.

sudo zpool create zfs mirror /dev/sdb /dev/sdc creates a mirrored pool named zfs using the two disks in a mirrored configuration. Instead of residing in the /media or /mount directory, it can be found in the root of the file system.

sudo zpool list confirms that the pool exists:

zfs   1.81T   496K  1.81T     0%  1.00x  ONLINE  –

The next step will be to test the pool, writing data to it, unplugging one of the disks, formatting it, adding it to the pool again and check if everything works as fine as it should.

Before doing that I’ll set up a samba share on the zfs directory. This will provide me with a real-world situation where I can access the pool from another computer in my network.

Recent projects

So.. After a diving trip it’s about time to write up on two recent projects:

  1. Home server: As I wanted to get into Linux for a long time and also wanted to set up a home server for VPN/SSH/FTPES/firewall/my own Exchange replacement and sharing of music and movies in my own network (and remote, of course), this seemed like a good time to dive in. Starting with a generic Ubuntu server package without GUI I’ve started setting up a low power system that I can leave on permanently without having to worry about it too much. A good opportunity to read up on current computer hardware as well.
  2. Dive light: a while ago I bought a halogen dive light with the idea of using the housing for a diy LED dive light. Benefits: light output, can choose my own beam characteristics, longer runtime. Drawbacks: colour reproduction. Pretty much still a work in progress, but I’ve done about 20 dives with a system with 2 XM-L’s driven at about 900 mA’s and easily lights up the beachfront after a night dive. Also: first time working with a lathe.

More about these two soon.