Exercise Stimulates Creativity And Motivation

I noticed multiple times now that during my workouts my mind is generating lots of new ideas for coding projects or blog posts. It is a well known fact that walking stimulates areas in the brain that which will in turn stimulate creativity. But I’m noticing that it starts to happen with strength workouts as well. Although I don’t struggle with the motivation to get myself to the gym, I sometimes feel “guilty” for not spending that time on coding or studying. I’m realizing now that this is a very irrational train of thought. ...

April 1, 2023 Â· Mischa van den Burg

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

I Wrote My First Go Program Today

I’m still at the beginning of my Go learning journey, but I worked through a few tutorials and guides by now. I’ve gathered lots of ideas for programs that I want to write, big and small, but I have to start somewhere. The best thing to do is to write little programs that solve a problem that you have. One problem I needed to solve was converting sentences to title case in vim. There are plugins for this, or elaborate macros, but I thought this was a nice opportunity to write my first program from scratch. You can view the program here: my go repo. ...

March 28, 2023 Â· Mischa van den Burg

Go - Reading from Standard Input Provided by User

I’m working through the “greet” challenge by rwxrob. It is amazing how such a relatively simple and small challenge can lead down to so many rabbit holes. The program should take input from the user and print it out. I worked through the challenge together with Rob in his video but I’m going to talk (write) myself through these functions to fully understand what’s going on. We have the following function in main.go: ...

March 26, 2023 Â· Mischa van den Burg

Go - Skillstak Beginner Boost Week 17 and 18 Notes

Beginner Boost Week 17 and 18 Notes Link to video Don’t forget to set GOBIN=~/.local/bin, GOPRIVATE, CGO_ENABLED=0 Go Testing - Example Tests func ExampleFoo() { foo() // Output: // Foo } The ExampleFoo indicates the test here. It needs to match the name exactly after Example. But it is capitalized. It runs that function and will compare the output to what is specified. It says “see if the program generates this output in std out”. ...

March 26, 2023 Â· Mischa van den Burg

Made Some Website Improvements

Did some website housekeeping today. Spent the entire morning on a few tasks that I intended to do for a while. I added a search page and reorganized the menu, and I added a “Start Here” page. I hope that the new “Start Here” page will do a better job of explaining the how and why of my website, and that the search function will help you nagivate my website better. ...

March 25, 2023 Â· Mischa van den Burg

How to Surround a Word with Quotes in Vim

[[Neovim]] I find myself quoting words very often in vim when I’m writing bash code. I used to do this by simply navigating around the word and typing them, but I knew there had to be a better way. I found this vim command: ciw""<Esc>P “c” deletes into register and enters insert mode. “iw” stands for “inner word” and selects the word. So we delete the entire word and enter insert mode. Then we type two quotes, and we press “P” to paste the register (containing the word) before the cursor. ...

March 21, 2023 Â· Mischa van den Burg

What is the difference between a Go module and a package?

A module is generally associated with a single git repo. You can have a module with multiple packages, and each package would get its own subdirectory. You should always name your main file main.go creating a module Use the go mod init {{your path here}} command to initiate a module. multiple modules I was running into some trouble with this because I want to have one big repo where I will store all my go projects. ...

March 20, 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

Notes: Advanced Bicep

Deploying to subscriptions and management groups To tell Bicep which scope to deploy to, use the targetScope keyword, for example, managementGroup. You’re not specifying which management group exactly, this is done during deployment of the template file. targetScope can be set to resourceGroup, subscription, managementGroup or tenant. If it is not set, Bicep assumes resourceGroup. create a resource group targetScope = 'subscription' resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-01-01' = { name: 'example-resource-group' location: 'westus' } To deploy you use az deployment group create for resource groups, but you use az deployment sub create for subscriptions, mg for management group and tenant for tenant. ...

March 18, 2023 Â· Mischa van den Burg