Generating Markdown Headings with YYYY-MM-DD Date Format Using Bash

A couple of weeks ago I created a simple bash script to generate a date in format YYY-MM-DD to use with the magic !! wands in vim. Just now I wanted to expand this with being able to create a markdown header with this date. #!/bin/bash # Gendate generates the date in YYY-MM-DD format # Can be called with arguments h and number to generate a markdown heading # For example: 'gendate h 3' will generate '### 2023-03-29' header="" date=$(date +"%Y-%m-%d") if [[ $# -gt 0 ]]; then # handling wrong arguments if [[ $# -eq 1 || "$1" != "h" ]]; then echo "Usage: gendate h 2 to generate with markdown heading ##" exit 1 fi # format markdown heading if arguments h, n are given if [[ $# -eq 2 ]]; then for i in $(seq 1 $2); do header+="#" done header+=" "$date echo "$header" exit 1 fi fi # if no arguments given, generate the date echo "$date" Links: 202304011104 ...

April 1, 2023 · Mischa van den Burg

Kubernetes Resource Management for Pods and Containers - CPU and Memory

Pods have containers, and limits can be set on those containers. Requests used by the kube-scheduler to determine where the Pod will be placed containers can use more than requested resources if it is available on node If a limit is specified, but no request, Kubernetes will use the limit value as the request value. Limits containers may never use more than the set limit enforced by kubelet and container ...

March 28, 2023 · Mischa van den Burg

How to Run Newsboat in Zenmode

To read the news free from distractions and ads I use Newsboat as a reader for RSS feeds. However, one thing that annoyed me was that it would span across my entire screen in the terminal. When you read blogs or news pages in the browser, you’ll notice that the text is always located in a middle column of the window, so you don’t have to move your neck while reading. At least, this is the case with well designed websites that serve text content. ...

March 26, 2023 · Mischa van den Burg

Had a CLI Shokunin Moment Today

Today was meal-prepping day and I cut up some vegetables for the coming week. I’m on a strict caloric restriction regimen and need to meticulously track and plan all the food that I consume. I cut up three kinds of vegetables and wrote down how many grams of each I cut up so I could divide them by three and add them to my calorie tracking application. As I took out my phone to pick up my calculator to divide each number, my inner engineer started complaining about the fact that I had to do three calculations and that it would be much better to loop over an array of these values. ...

March 19, 2023 · Mischa van den Burg

How to continuously run a Go file while coding in the terminal

I do all my coding and note taking in the terminal using tmux and neovim. I picked up a nice trick from Rob Muhlenstein today. You can use this command in a split window to keep running a Go file. It will update when you save the file. entr -c bash -c "go run main.go" <<< main.go Entr runs commands when files change. Here we are feeding it only one file, but you can also feed it a directory like so: ...

March 19, 2023 · Mischa van den Burg

Setting up a Kubernetes cluster on an Ubuntu 20.04 VM with containerd and flannel

You can get a free 24GB ram VM from Oracle. What better place for your own Kubernetes lab that is always available? See this article to create your VM. Here are the steps I took to install a single node kubernetes cluster on the Ubuntu VM. Installation sudo apt-get update sudo apt install apt-transport-https curl Install containerd sudo mkdir -p /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install containerd.io Remove the default containerd configuration, because it creates errors when running kubeadm init. ...

February 5, 2023 · Mischa van den Burg

Get a free 4 CPU 24GB Ram VM on from Oracle

A few weeks ago someone gave me a tip. Oracle actually has a really good free tier offering. You can host a 4CPU 24GB VM for free! This is perfect for a lab environment. I spent my evening creating the VM and setting up a kubernetes cluster from scratch. Use this video to claim your free vm: https://www.youtube.com/watch?v=NKc3k7xceT8

February 4, 2023 · Mischa van den Burg

Setting up a new LUKS encrypted disk with dm-crypt in Arch Linux

Today I added a harddisk I had lying around because I needed some more space. On my Arch Linux system I have all my drives encrypted like a good boy. It can be a bit tricky when you are adding them because you need to configure a few different files and add different UUID’s in each of them. Here are the steps I follow to add a new disk. Note that this how to assumes that you already have set up your system with dm-crypt. ...

January 21, 2023 · Mischa van den Burg

Setting up automated backups on my Arch Linux system with rsync and bash

For the past few months I’ve been stuyding every hour of free time that I had. Now that I reached my certification goals for now, I finally had some time to do a chore I had been meaning to do for a long time. My Arch Linux system is fully encrypted, and I make backups. But I was still doing it a bit haphazardly, usually every Friday. I wanted to automate this for a long time now, but I never got round to it. Today I made the first steps, but it is still in progress. ...

January 21, 2023 · Mischa van den Burg

Using parameter expansion as search and replace

Last modified: 2023-01-10 In this evening’s studies I came across this bash script in a tutorial by Rob Muhlenstein: !#/bin/bash echo -e ${PATH//:/\\n} I could not make heads or tails of all these slashes and curly braces, since the output clearly indicated that search and replacement was being performed. I’m used to the sed / vim syntax: s/foo/bar After some research I learned that ‘//’ is a global search and replace syntax of several text processing programs. It is known as parameter expansion in bash. ...

January 10, 2023 · Mischa van den Burg