April 1, 2021

Using Webpack as browserify

My initial setup was bundling everything together into one javascript bundle, however, I wanted to lower the building time and get faster feedback loops. For this I am using shimming and EcmaScript 6 modules. Shimming npm packages using webpack The default way (by webpack) of accessing modules (global variable), wasn’t my cup of tea, the current approach is inspired by this. We first create the shim: import * as mod from 'yamljs' if (! Read more

March 30, 2021

Tax advantage of a freelancer

In this blog I will show you how to increase your spending power by 2.4 times as a freelancer. Note that this only applies to goods that you need for your business, like a phone, laptop etc. Or you can be create; a friend of mine wanted a camera drone and bought it on his business. He makes one video per year for a customer besides using it for all his vacations. Read more

March 23, 2021

Export csv from Google sheets

For a PoC, I wanted to use Google sheets as a data store for rendering charts. Trying to share a sheet via ‘Publish to the web’ as a csv did not work, since it’ll redirect you to an HTML page first, which makes it unusuable for automated systems. Searching for a solution lead to someone who shared how to get the xlsx exported, which helped me find out how to get it as csv. Read more

March 15, 2021

Microk8s cert-manager issue

After migrating my server, microk8s had been updated, as well as cert-manager. This gave some errors: "msg"="propagation check failed" "error"="wrong status code '404', expected '200'" Initially I thought the issue was between a version mismatch, but when my nginx based service wasn’t working either I found: kubectl logs -n ingress nginx-ingress-microk8s-controller-*|grep annotation I0315 15:33:07.280902 6 store.go:363] ignoring add for ingress REDACTED based on annotation kubernetes.io/ingress.class with value I0315 15:39:55.955968 6 store. Read more

February 6, 2021

Calculating hashes in Python without Python

The law of the instrument tells us that we might not use the best tool for the job. In this post we show an example where Python is not the tool for the job. We created a simple script which adds the hash of a file in the filename, enable you to detect data degration for cold storage. Note that I only use Unix systems (Linux, Android and Chromebook). When creating the following script using Python, you would likely first read the file into memory and then calculate a hash, as seen in the following script: Read more

January 13, 2021

Analytical approach to career switching

The conventional road to a vocation is through an education. In this post I try to show an alternative way of pivoting to a different career without going back to school/university. Personally I had my fair share of pivoting early on. My education started with mechatronics, since I liked creating stuff as a kid and doing mechanics and electronics combined seemed like a good fit. After this education I was able to create machines, but to control them required software, which made me study computer engineering. Read more

December 26, 2020

DIY Parcel box

This article describes how to create your own parcel box. It was motivated by the fact that I found a package in my bicycle crate in front of my house when coming home after being away for a few weeks. I still wonder how many there have been there originally but might have been stolen. In line with my work, I tried to come up with a technical solution that prevents changing the human (delivery guy). Read more

November 19, 2020

Grafana Toml to environment variables

The following snippet creates environment variables from your Grafana toml. #!/bin/sh # Script writes to env file and shows JSON lines on stdout if [ -z "$2" ]; then echo "USAGE: $0 ./inputfile.toml ./output.env" fi TF=/tmp/temp-grafana-conf.toml echo "[default]" > $TF cat $1|sed 's #.*$ ' >> $TF > $2 while read l; do if `echo $l|grep -q '^#'`; then continue fi if `echo $l|grep -q '^\[.*\]$'`; then PREFIX=`echo $l|tr -d '\[\]'` continue fi if `echo $l|grep -q '='`; then NAME="GF_$PREFIX" NAME=$NAME"_`echo $l|awk '{print $1}'`" NAME=`echo $NAME|tr a-z\. Read more

December 28, 2019

Home automation through device detection using MAC address

There are multiple ways of controlling home automation. This blog introduces another sensor to the network; detecting if someone is home through testing if the MAC address is present on the L2 network. Ping to MAC address The basis for our script will be: sudo su apt install -y arp-scan arp-scan --destaddr=04:b1:67:aa:bb:cc \ --localnet \ --interface="`iw dev|grep -o wlan[0-9]|head -1`" \ | grep '1 responded' The last command tests if the hardware address of the interface (e. Read more

November 27, 2019

An introduction to coding: chat bot for MS teams

This guide creates a script that monitors the current open chat and responds with a message if a new message has been received. In our previous introduction to coding we looked at a structural approach to gradually become a programmer. But that guide required bash, which takes some initial setup on Windows (using WSL). This post only requires the Chrome browser and access to teams.microsoft.com. Step 00 preparation Open teams. Read more

Blog by lent.ink