Blog

All my posts and notes. (Browse by tags)

Ansible and cowsay

Notes | 2023-09-20 (updated 2025-10-25) | 1 min read
#ansible

Cowsay is one of those packages you just end up installing randomly on just about any client over time.

And if your using ansible you may be in for a little surprise:

Read more…

Django: CSRF exempt view

Notes | 2023-09-17 (updated 2025-10-25) | 1 min read
#django #python

Django’s CSRF protection is usually a great thing, but when building (API) endpoints meant to be accessed by scripts/third parties it gets in the way of that.

This is how to disable it:

For a class based view

from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt

@method_decorator(csrf_exempt, name='dispatch')
class MyView(View):
    pass

For a function based view

from django.views.decorators.csrf import csrf_exempt

@csrf_exempt
def my_view(request):
    pass

My Publishing Pipeline

Update for 2023

Posts | 2023-08-25 (updated 2025-10-26) | 6 min read
#gitlab #hugo #pkm #productivity #scripting #writeup
Series: Tech Behind the Blog

I write an extensive personal knowledge base using markdown, code-server and a variety of other tools. Originally, in 2021, I wanted to have something like Obsidian Publish but self-hosted, so I created it.

Over time my knowledge base evolved more into a second brain, tracking not only my technical notes and journal, but also things like recipes and hikes. With this my publishing pipeline, and the script at it’s core, extended in a multitude of ways.

Read more…

The (MVP) Making of PodHistory

Posts | 2023-08-06 (updated 2025-10-22) | 4 min read
#indie-hacking #products

Landing page of PodHistory

In this post I share my process for building the MVP for PodHistory, from idea to launched product and what my next steps will be.

Read more…

Helm: Join two lists

Notes | 2023-07-22 (updated 2025-10-25) | 1 min read
#helm #k8s

Since early 2019 the sprig library used by helm provides a concat function that does exactly this.

Read more…

Simple Self Organization

Posts | 2023-06-18 (updated 2025-10-22) | 4 min read
#opinion #productivity

This is a guide to a simple self organization/task management system I built for myself over the years.

From time to time I showed it to someone and they got some benefits from it, most adapted it to better fit their needs down the line, which is exactly what you should do with any kind of personal task management in my opinion.

Read more…

HTMX

Notes | 2023-06-06 (updated 2025-10-25) | 1 min read
#htmx #slashpage-uses

Go check out their website, it’s incredibly good at explaining itself.

To me, a backend heavy developer, HTMX is the frontend framework I like to use because:

Handling signals with Python

Notes | 2023-05-10 (updated 2025-10-25) | 2 min read
#python

When building a Python script that is long running or has to manage some state on termination it is helpful to handle a couple of signals:

Handling them is possible with Pythons signals library:

import signals

class SignalHandler:
    stop = False

    def __init__(self):
        # Ctrl+C
        signal.signal(signal.SIGINT, self.exit_gracefully)

        # Supervisor/process manager signals
        signal.signal(signal.SIGTERM, self.exit_gracefully)
        signal.signal(signal.SIGQUIT, self.exit_gracefully)

    def exit_gracefully(self, *args):
        self.stop = True

Example 1: Simple loop

The simplest example is using the SignalHandler as the condition on the loop and have code to stop gracefully below the loop.

Read more…

Hack Things Together

A Little Scripting Never Hurt Anybody

Posts | 2023-04-27 (updated 2025-10-22) | 3 min read
#automation #opinion #productivity

Sometimes you have to do a specific task and you are fully capable of doing it manually, however those tasks are also great to flex your muscles and hack something together.

They can be an excellent tool to sharpen your skills with the tools you use regularly, and improve your quick prototyping skills.

In addition, with a couple of iterations, again sharpening an important skill, you could afterwards create a more general purpose tool from a hacky script.

Read more…

My home office setup: 2023 edition

Notes | 2023-04-22 (updated 2025-10-25) | 3 min read
#homeoffice #personal #slashpage-uses

Since I spend more than 8 hours here most days I created a nice setup for myself. Thankfully I have a whole room just for my home office, so I take full advantage of that.

Besides my main desk I have a secondary desk, a couch, a couple of sideboards, a wall mounted whiteboard and a couple of shelves to display all the techy and nerdy things.

Main desk

My main desk is a custom build based on a FlexiSpot height adjustable electric frame. The tabletop is a 180x80x2.5cm pressed wood panel in a dark gray concrete look.

Read more…

Enable system extensions on Apple silicon Mac

Notes | 2023-04-20 (updated 2025-10-25) | 1 min read
#apple-silicon #macos

Think before you enable this, it could be a security risk

DigitalOcean CLI Cheat Sheet

Notes | 2023-04-15 (updated 2025-10-25) | 1 min read
#bash #digitalocean #doctl #infrastructure #productivity

Read more…

My Thoughts on AI in Blogging

Posts | 2023-04-04 (updated 2025-10-22) | 2 min read
#ai #opinion #productivity

Given the recent rise in text-based language models, sometimes called AI tools, I wanted to share my thoughts and experiences in using them, especially in the context of blogging.

Read more…

My hiking kit: 2023 edition

Notes | 2023-04-01 (updated 2025-10-25) | 3 min read
#hiking #personal

These days I enjoy hiking quite a lot. To make it easier to just “pick up the pack and go” I created two basic packs that are optimized for my needs and the environment I’m usually hiking in, the Swabian Alps.

Basics

I have some basics I duplicated and carry in both my packs, these are:

Prepared packs

Small pack

I’m currently using a Terra Peak Flex 20l in red for my smaller backpack. It’s a nice size for shorter hikes and fits me well.

Read more…

What to Do With Your Own Server

Tools, Tips & Tricks

Posts | 2023-03-19 (updated 2025-10-22) | 4 min read
#infrastructure #self-hosted #sysadmin
Series: Your Own Server

Various tools on a table

Now that we have talked about the benefits of running your own server and how to run your own server let’s take a look at some things you could run on your own personal server and some things you should better not.

Read more…

How to Run Your Own Server

Posts | 2023-03-18 (updated 2025-10-22) | 3 min read
#infrastructure #self-hosted #sysadmin
Series: Your Own Server

There are many ways to run your own server, from setting up a Raspberry Pi on your desk to renting a physical server at a provider.

In this post, we will focus on setting up a virtual server with DigitalOcean, which is one of the easiest ways to get started.

Read more…

Benefits of Running Your Own Server

Posts | 2023-03-17 (updated 2025-10-22) | 2 min read
#infrastructure #opinion #self-hosted #sysadmin
Series: Your Own Server

Three wired server racks with lights on

In the world of technology, we are moving further and further away from operating directly on servers, but there are still significant benefits to be gained from running a personal server.

I have been running some kind of personal server for many years now and I strongly believe anyone working in technology can benefit greatly from doing so. Here’s why:

Read more…

The (MVP) Making of Honeypot Login

Posts | 2023-03-12 (updated 2025-10-22) | 3 min read
#indie-hacking #products

In this post I will go over the MVP building phase of Honeypot Login, from idea to launched product and what my next steps will be.

Read more…

1Password CLI Cheatsheet

Notes | 2023-02-01 (updated 2025-10-25) | 1 min read
#1password #cheatsheet

The 1Password CLI op works either in connection with a client app, like on the Mac, or standalone, useful on a server.

# Login
eval $(op signin)

# Get favorites
op item list --vault "Private" --favorite

# Get a specific item
op item get <ID>

# !! Important: Sign out at the end
op signout

Some helper functions

Helpers to more easily work with the op cli.

1login() {
    eval $(op signin)
}

alias 1signout="op signout"

1search() {
    term=$1
    if [ -n "$2" ]
    then
      vault="$2"
    else
      vault="Private"
    fi
    echo "Searching for '$term' in vaut '$vault'"
    op item list --vault "$vault" --long | grep "$term" --ignore-case
}

1get() {
    op item get $*
}

Being a good code reviewee

Notes | 2023-01-13 (updated 2025-10-25) | 1 min read
#code-review #merge-requests

Things I do to be a good code reviewee.

Read more…

yamllint error: "invalid config: ignore should contain file patterns"

Notes | 2023-01-12 (updated 2025-10-25) | 1 min read
#linting #yaml #yamllint

Setting up a new repository for YAML linting today I was running in a bit of an issue with yamllint.

I was using a YAML list to specify ingores, as mentioned in the documentation:

ignore:
  - "*.dont-lint-me.yaml"
  - "/bin/"
  - "!/bin/*.lint-me-anyway.yaml"

This however did not work with the above mentioned error message. After a lot of debugging I found that they released a new version recently which introduced this feature.

My solution was to update my locally build container image to the latest version, as of writing 1.29.0, in which this feature is introduced.

Read more…

Hy-Fit App by Tenswall no longer working

Notes | 2023-01-11 (updated 2025-10-25) | 2 min read
#hy-fit #rant #tenswall

This is somewhere between a rant about the app and backing services no longer working, a collection of information I could find out about it and a possible search-result for others facing the same issues and not really finding anything online just like me.

Update: March 2023

The company seems to no longer exist.

I have switched to the eufy smart scales, which are made by Anker, a reputable manufacturer.

Read more…

ArgoCD Python Client

Notes | 2023-01-01 (updated 2025-10-25) | 3 min read
#argocd #python

A simple Python client to interact with ArgoCD.

Read more…

WSL2 & Keychain

Notes | 2022-12-08 (updated 2025-10-25) | 1 min read
#linux #ssh #wsl

The problem

If you use ssh-agent with an encrypted ssh key it does not persist when you open a new terminal window.

The solution

Use keychain instead.

  1. Install
    sudo apt install keychain
    
  2. Add to your shells rc file, eg. .bashrc or .zshrc
    # Repeat this line for all keys you want to unlock and use this way
    /usr/bin/keychain -q --nogui $HOME/.ssh/id_rsa
    source $HOME/.keychain/wsl-sh
    
  3. Unlock your keys on shell startup and enjoy

My Tools

Notes | 2022-11-25 (updated 2025-10-25) | 1 min read
#productivity #tools

Tools I use and recommend.

Self-Hosted Notifications

Posts | 2022-11-01 (updated 2025-10-22) | 3 min read
#notification #open-source #productivity #self-hosted #sysadmin

A notification of a failed backup on mkamner-code.local as displayed by ntfy.sh

Running any kind of personal infrastructure sometimes requires your attention based on certain events or failure states, no matter how much you automate tasks.

Over the years I have used E-Mail, Telegram bots and a variety of other tools for this purpose. However all of them have the drawback that they mix with other kinds of information and are not easilly usable in scripts.

Read more…

Audible book export

Notes | 2022-10-24 (updated 2025-10-25) | 2 min read
#archiving #audible #ebook

Read more…

Git: Add only changed files

Notes | 2022-09-29 (updated 2025-10-25) | 1 min read
#git

Sometimes you may want to commit only the files you have changed and not any newly created files, this can easily be achieved by this command: git commit -a

Read more…

A list of interesting things

Notes | 2022-09-29 (updated 2025-10-25) | 2 min read
#personal

This is a list of interesting blog posts, talks and such things that I found over the years.

Some of them may teach you something relevant, some may just further your general understanding of tech. From personal experience they can lead you down the rabbit hole really fast, enjoy with care!

Talks

Blog posts

Guides & Books

Other things

Post Mortems

Learning From Incidents

Posts | 2022-08-22 (updated 2025-10-22) | 5 min read
#devops #management #opinion #post-mortem #process

Incidents happen, and we can and should always learn from them, to be better prepared for the next time things go wrong.

A great tool to do that is the post-mortem, it is a process designed to recap the incident, learn from mistakes and improve the system as a result.

Read more…

Publish new post checklist

Notes | 2022-08-21 (updated 2025-10-25) | 2 min read
#personal

This is my checklist for publishing a new post on my blog:

Preparation

Proofing

Read more…

GitLab: User owned projects report

Notes | 2022-08-17 (updated 2025-10-25) | 1 min read
#gitlab #python

Export a CSV formatted report of projects in user-namespace on a GitLab instance.

This is especially useful if you think about limiting or disabling this feature.

Read more…

Monoliths & Microservices

An Opinionated Overview

Posts | 2022-07-18 (updated 2025-10-23) | 6 min read
#devops #infrastructure #microservices #monoliths #software-architecture

Ever since diving into the software development world I was troubled by a duality:

On the one hand I have built and operated many services described as monolithic with relative ease, on the other hand I’m always told I, and others, should build microservices because they are better in a variety of ways.

With this post I’m going to compare both software architectures by looking at the key benefits often associated with microservices and additional considerations I think are important.

Read more…

Simple git changelog

Notes | 2022-07-08 (updated 2025-10-25) | 1 min read
#git #productivity

A simple changelog system on top of git commit messages.

The main idea is to generate “release notes” from a diff in commits before a release. It can easily be run manually or as part of a merge/pull CI pipeline.

In this case it looks for commit messages starting with one of these [ADD], [REMOVE], [INFO] and just outputs those, but those patters can be adjusted to fit any existing commit schema.

Read more…

The WSL Onion

Calling Powershell.exe From PowerShell Inside WSL

Posts | 2022-04-06 (updated 2025-10-22) | 2 min read
#debian #powershell #windows #wsl

The other day I was playing around in WSL with a colleague of mine and we did this:

Read more…

Windows Subsystem for Linux 2: Debian & Podman

Posts | 2022-04-04 (updated 2025-10-22) | 3 min read
#containers #debian #docker #podman #wsl

Stacked containers in a ship yard

The problem: Docker itself can’t be run in WSL2 as it requires the docker daemon, usually run though systemd.

The solution: Podman works just fine and can easily be installed, although we will need to configure some things to make it work properly.

Read more…

Going Part Time

(Re)starting My Indie Journey

Posts | 2022-04-03 (updated 2025-10-22) | 2 min read
#indie-hacking #personal

Starting on the first of March 2022 I no longer work full-time in my day job.

That sentence has been about a year in the making and makes me both happy and a bit scared about the future.

Read more…

Simple HTTP Status Monitor Using Curl

Posts | 2022-03-16 (updated 2025-10-22) | 2 min read
#bash #curl #monitoring

Using some output redirection and the --write-out parameter we can produce a script that simply outputs the status code of a curl request.

Read more…

yamllint: Ignore exisiting errors

Notes | 2022-01-14 (updated 2025-10-25) | 1 min read
#automation #cicd #yaml #yamllint

When adding yamllint to an existing project it can be hard to fix all the errors at once.

I wrote a simple script to create a rules block that simply ignores all rules that currently trigger for a file. This works by generating a rules block ignoring paths.

Read more…

Local User Management Polyfill

Notes | 2022-01-13 (updated 2025-10-25) | 1 min read
#powershell

Older Versions of Windows 10 and all Windows Server 2012 systems have no local user management commandlets.

This is a working polyfill to allow scripts using local user management to run on old systems.

Source code

PSGallery package

Local S3 with MinIO in Django

Notes | 2021-11-06 (updated 2025-10-25) | 2 min read
#django #minio #python #s3

In production I would consider it best practice to use a S3 solution for serving assets. Namely static files and user-generated media.

This describes my setup on how to do this locally too.

The main benefit for me is that there is less of a difference between environments and I can test S3 specific features in my app.

Setup

I will assume a already working Django project and MacOS with [[brew]] installed, but brew specific parts are easilly replicated on different systems using their native package managers.

Read more…

Windows Terminal: Open New WSL Tab In Linux Home Folder

Notes | 2021-08-30 (updated 2025-10-25) | 1 min read
#windows #windows-terminal #wsl

The path you are in when opening a new WSL tab is determined by startingDirectory. This parameter needs to be a valid Windows path, which isn’t great if we want to end up in /home/kamner inside WSL.

The nice thing about WSL is that it will resolve windows paths into their equivalent WSL/linux path if possible.

For example, C:\Scripts would resolve to /mnt/c/Scripts.

Using this and the neat trick that the WSL filesystem is exposed as a a hidden fileshare ([[technology/windows/wsl-hidden-fileshare]]) we can get to where we want.

Read more…

Hidden WSL Fileshare

Notes | 2021-08-30 (updated 2025-10-25) | 1 min read
#windows #wsl

WSL file systems get exposed as a hidden share network share: \\wsl$\<WSL Name>\<path\to\file>

For example, my Debian home folder is at: \\wsl$\Debian\home\kamner

Resolve .local Through Nameserver With Netplan

Notes | 2021-08-13 (updated 2025-10-25) | 1 min read
#dns #linux #netplan #sysadmin

When using netplan it is easy to force .local DNS requests to go to you nameservers instead of being only resolved locally (the default and standard).

This also works with all other strange .WHATEVER domains you may have lying around in your organization.

Snippet from netplan configuration:

 nameservers:
        addresses:
          - X
          - Y
        search:
          - local
          - myotherstupiddomain

MongoDB Logrotate

Notes | 2021-08-12 (updated 2025-10-25) | 2 min read
#ansible #linux #logs #mongodb

MongoDB does not rotate it’s log on it’s own.

To get it to ratet we will use logrotate.

First, we need to configure some things in mongod.conf to get the desired behaviour when we utilize logrotate.

systemLog:
 destination: file
 path: /var/log/mongodb/mongod.log
 logAppend: true
 logRotate: reopen

Afterwards, we can create a logroatet configuration going in /etc/logrotate.d/mongodb.

/var/log/mongodb/mongod.log
{
 rotate 5 # Keep the last 5 rotated logs, so 6 files including the currently active
 size 10M # Rotate once the log reaches 10MB in size, depending on your envrionment you could instead use daily, weekly, monthly, etc
 missingok # It's ok if the log file does not exist
 create 0600 mongodb mongodb # Permissions and ownership for the roatetd logs
 delaycompress # Don't compress on first rotation, so we have the current log and log.1 uncompressed
 compress  # Compress everything else
 sharedscripts # Run this script only once and not for every matching file
 postrotate # Script to run after rotating
 /bin/kill -SIGUSR1 $(systemctl show --property MainPID --value mongod.service)
 endscript # End of script
}

The postrotate script simply finds the PID of mongod.service: systemctl show --property MainPID --value mongod.service and sends it a SIGUSR1 which is the signal MongoDB expects if you wish to rotate the log.

Read more…

Show all active user cron jobs on a system

Notes | 2021-08-11 (updated 2025-10-25) | 1 min read
#cron #linux #sysadmin

Debian/Ubuntu

grep -vH "#" /var/spool/cron/crontabs/*

RedHat/Centos/Rocky

grep -vH "#" /var/spool/cron/*

DNS Resolution Everywhere

Notes | 2021-08-10 (updated 2025-10-25) | 1 min read
#container #dns #linux #sysadmin

Usually at least one of those is present on any system

But sometimes the usual suspects don’t work, especially in container-land. After trying them you may try some more involved/unknown things:

getent

Part of glibc, this will probably work on nearly every system.

getent hosts example.org

Or, if you specifically want to query A or AAAA records.

getent ahostsv4 example.org
getent ahostsv6 example.org

Using Python2 Or Python3

Given this depends on glibc it is more of a alternative then another real solution.

Read more…

Customize Freshervice User Portal

Notes | 2021-08-10 (updated 2025-10-25) | 2 min read
#freshservice

It is possible to customize almost all of the user portal but you better know what you are doing. Otherwise you may end up like me, spending way more time than you ever should on customizing this damn portal.

Let’s hope this one helps you, otherwise feel free to reach out to me on Twitter.

Place a variation of the below at Admin > General Settings > Helpdesk Rebranding > Requester Portal Branding > Customize Portal > Layout And Pages > Portal Pages > General Pages > Portal Home

Read more…

Publish Parts Of Obsidian To My Personal Site

Notes | 2021-08-09 (updated 2025-10-25) | 4 min read
#gitlab #hugo #obsidian #pkm #productivity #writeup

The idea at the start was simple. Do something like Obsidian Publish , so read frontmatter and if it contains published: True put it up on a website to view.

I have since rewritten and updated this tool: New version

The Basics

I started with taking a look at different static site generators but after a bit of testing I ended up back at Hugo, which I already use for ps1.guru and a few other projects.

Read more…

Publish Parts of Obsidian to My Personal Site

Posts | 2021-08-09 (updated 2025-10-22) | 4 min read
#gitlab #hugo #obsidian #pkm #productivity #writeup
Series: Tech Behind the Blog

The idea at the start was simple. Do something like Obsidian Publish , so read frontmatter and if it contains published: True put it up on a website to view.

Read more…