Obsidian Templating

What is this?

This shows how to automatically insert properties to your note in Obsidian. Rather than having to type out or copy/paste each time, you can create a shortcut to do this automatically. This example will create the following properties:

---
title: note-title
date: 2025-05-10
tags:
  - publish
---

Step 1: Install the Templater plugin

https://github.com/SilentVoid13/Templater Make sure you’ve plugins enabled then search for this and install it. There’s loads of resources to do this

Step 2: Configure the plugin

The only thing you need to do here is configure the “Template Folder Location” to be a specific folder. You can name it anything but choose a name of a folder that’s not already in your vault. I’ve chosen templates

Step 3: Create your template

Now create the templates folder and create a new file in it, called properties

---
title: <% tp.file.title %>
date: <% tp.date.now("YYYY-MM-DD") %>
tags:
  - publish
---

You can edit this to add whatever properties and tags you wish.

Step 4: Test it out

In a new or existing note, place your cursor at the very start of the file. Now execute the template by opening the command pane (cmd/ctrl + P) and searching for Templater: Open insert template model and then select the properties function

Going further

You can specify an exact hotkey for your template so you don’t even need to go via the command pane. This can be done via the Templater settings

May 10, 2025 · 2 min

Papercuts

Improving tooling, documentation, or dev loops. A tiny amount of time fixing a papercut in the right way can save hundreds of users hours of debugging or schlepping through inefficient workflows. https://www.benkuhn.net/impact/

Often it is way too easy to look past these papercuts or just accept them for being “the way things are”. They all add up but when the focus of the task is on something else, often you forget these things. Sometimes though they’re things that are just that little bit too difficult to fix or the solution is unclear so they go unfixed for a long time, sometimes forever. For example a proper dev environment is a huge multiplier for everyone on the team but setting it up correctly is a serious undertaking and if it is not done correctly from the start then it can be ignored often to the detriment of everyone. But because it is not a simple fix then everyone is unhappily going along with it because they can’t see a better way out

I agree with a lot of the stuff in the original post and is well worth the read.

May 10, 2025 · 1 min

Golang Context

Context Lifecycle

In general a context is:

  • created by incoming requests to a server
  • accepted by outgoing requests
  • propagated between them

This means the context is passed through the functions rather than being stored in the struct. Typically it is the first argument in a function ctx asf

Cancelling Context

There’s three main ways to cancel context in Golang. The one you pick depends on whether you want to do the cancellation yourself or let it get cancelled automatically at a certain time.

func WithCancel(parent Context) (Context, CancelFunc)

This is the one where you’ve to figure out for yourself when the context should be cancelled. You pass in the ctx and get back a ctx and a cancel() function.

func WithDeadline(parent Context, t time.Time) (Context, CancelFunc)

This works by passing in the exact time the context should be cancelled at

func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc)

WithTimeout() - this is just a wrapper on the previous one but instead of an exact time you pass in a duration, after which the context will be cancelled at

What happens when cancel is called?

Calling Cancel stops the process and releases the resources associated with the context.

Why do WithTimeout and WithDeadline return a CancelFunc?

If the process finishes earlier than the Deadline or Timeout then you want to release the resources as soon as possible, rather than waiting for the deadline to pass.

Resources

https://pkg.go.dev/context https://go.dev/blog/context-and-structs https://go.dev/blog/context https://www.prakharsrivastav.com/posts/golang-context-and-cancellation

More Questions

  • How does a child Goroutine listen for cancellation?
  • How does cancellation propagate down the call chain
April 25, 2025 · 2 min

Abroad in Japan

The gist of this book is a guy, from the UK, moves to Japan after college to work in a school over there. With no Japanese and never being there before, it’s a trial by fire and he’s to deal with the culture clash and other random situations of a small, relatively rural corner of Japan. A while in he starts a YouTube channel and this grows over time into a great success.

The book itself is split into two parts. The first is about moving to Japan, getting over the culture shock and settling in. The second is about his success as a YouTuber and the opportunities that afforded.

I think the best/most interesting thing about this book for me is the first part. I’m not saying the second part isn’t good, but it does take a different approach to things. The first very much focuses on the small details of living in a relatively unknown corner of Japan. Even just moving to a new country is an interesting story, much more so a country like Japan where the language barrier is great and the culture is vastly different to somewhere like the UK. I find it just so interesting to learn about the mundane or trivial every day interactions. I read before, in The Discovery of France the following quote about how the more people that have an experience, the less evidence we have about it:

IT SEEMS TO BE a law of social history that the greater the number of people with a particular experience,

Read Full Post...
April 18, 2025 · 5 min

Optimistic Locking

Optimistic locking Transactions proceed freely without acquiring locks, only at commit time are they checked for potential conflicts. This means that a HUGE number of transactions can be in flight without locking contention.

In opposed to pessimistic locking where the transaction acquires the lock before attempting the transaction.

April 18, 2025 · 1 min

Napoleon

Napoleon was a bona fide intellectual, and not just an intellectual among generals. He had read and annotated many of the most profound books of the Western canon; was a connoisseur, critic and even amateur theorist of dramatic tragedy and music; championed science and socialized with astronomers; enjoyed conducting long theological discussions with bishops and cardinals; and he went nowhere without his large, well-thumbed travelling library. He was to impress Goethe with his views on the motives of Werther’s suicide and Berlioz with his knowledge of music. Later he would inaugurate the Institut d’Égypte and staff it with the greatest French savants of the day. Napoleon was admired by many of the leading European intellectuals and creative figures of the nineteenth century, including Goethe, Byron, Beethoven (at least initially), Carlyle and Hegel; he established the University of France on the soundest footing of its history. He deserved his embroidered coat.

  • Napoleon the Great (Andrew Roberts)

He seemed to read everything and anything he could get his hands on. And not only that but he would remember it too as evident by the respect of experts in the field he was reading about.

.

April 17, 2025 · 1 min

Curiosity

Mastering the art of asking the right questions isn’t just about filling your head with more information; it’s about sparking curiosity, embracing the unknown, and being okay with not having all the answers.

Curiosity

April 16, 2025 · 1 min

The Score Takes Care of Itself

Looking back, perhaps the lesson I would draw is this: If you don’t love it, don’t do it. I loved it—teaching people how to reach in deep to fulfil their potential, how to become great. And when you do that with a group, you, as the leader, enjoy the thrill of creating a great team. For me it was like creating a work of art. Only instead of painting on a canvas, I had the great joy of creating in collaboration with others.

The Score Takes Care of Itself - Bill Walsh

I’ve come across this a few times the last day or two where you should aim to do something that you really love doing. The other was a Founders podcast about Ken Griffen of Citadel who’s been doing that for 30 odd years now and also makes the claim that you need to love what you’re doing. He also brought up how we all dedicate our lives to something, so you may as well make it worthwhile. For some that could be mastering a niche skill or hobby, for others it might be their kids, and others yet again it might be work related. But regardless, at least try make it worthwhile and make it something you enjoy doing. And at least try be better than the rest.

April 10, 2025 · 2 min

NFTables

This means that when a packet comes in, the time it takes the kernel to check it against all of the Service rules is O(n) in the number of Services. As the number of Services increases, both the average and the worst-case latency for the first packet of a new connection increases (with the difference between best-case, average, and worst-case being mostly determined by whether a given Service IP address appears earlier or later in the KUBE-SERVICES chain).

https://kubernetes.io/blog/2025/02/28/nftables-kube-proxy

NFTables are an alternative to iptables in kubernetes that should be better for high load clusters. There’s obvious difficulties with replacing such a critical piece of functionality for kubernetes so it definitely needs a lot more testing in the real world before it is put into production systems. But the benefits are there and are clear. It is far faster, especially at high scale. For packet routing iptables is O(n) whereas NFTables should be closer to constant time. As for inserting and making changes, iptables often has to make changes to everything, whereas NFTables can make much more incremental updates such as only to what has changed

With both iptables and nftables, the total size of the ruleset as a whole (actual rules, plus associated data) is O(n) in the combined number of Services and their endpoints. Originally, the iptables backend would rewrite every rule on every update, and with tens of thousands of Services, this could grow to be hundreds of thousands of iptables rules. Starting in Kubernetes 1.26, we began

Read Full Post...
March 6, 2025 · 2 min

What's the worst thing that can happen?

“What’s the worst that can happen?” As Churchill said, failure is seldom fatal, and just realizing that even the worst-case scenario is survivable can bolster your confidence.

  • The Charisma Myth

Failure being okay and nothing to be afraid of is something you read everywhere but never really internalise the message and learn from it. Too easy is it to not do something just in case things go wrong and you’ve to explain to others or figure out what has happened.

March 5, 2025 · 1 min