Today I learned

24hrs format for html inputs in Firefox


My system language on my linux machine is set to English, but as a German raised with 24-hour days, I simply cannot wrap my head around to get the 12-hours am/pm format intuitively. By the time I learned that am is in the morning and pm is in the evening. But when it comes to 12:00 as the mid of the day and 0:00 in the night, I’m lost.

Of course I have already set the time format to 24-hours in my system settings (Ubuntu Date & Time > Time Format set to 24-hour), but Firefox still uses the 12-hours format for html inputs with type="time".

As a solution you open about:config and set intl.regional_prefs.use_os_locales to true. Now simple <input type="time"> will use the 24h format!

Atomic Design


Today I stumbled upon Atomic Design. It is some kind of architectural pattern for the user interface. The goal is to build a reusable UI that is easy to understand and maintain.

It starts with atoms, which represent the smallest units of the UI like text, buttons or images. By composing atoms, you get molecules like a search input (label, input, button). Then there are organisms like the top navigation bar. Templates align organisms. In the end, Pages fill the templates with acutal data.

From my perspective, only the Pages connect to non-UI parts of the application. Hence the Atomic Design is only focused about the structure of the view.

Open Policy Agent


With OPA you implement decisions of policies, not their enforcement. This avoids confusion between multiple servers that might come from different implementations of the policies.

The decisions themselves are implemented using the Regi programming language.

Similar to Prolog, Rego is a declarative and logic programming language. A seldom choice, but a great fit for policies!

Overriding Go values with ldflags


You can override Go values with ldflags during the build.

That way, you can inject values like the current version, build date or the current commit hash.

go build \
    -ldflags "-X 'github.com/metal-stack/v.Version=$(VERSION)' \
              -X 'github.com/metal-stack/v.Revision=$(GITVERSION)' \
              -X 'github.com/metal-stack/v.GitSHA1=$(SHA)' \
              -X 'github.com/metal-stack/v.BuildDate=$(BUILDDATE)'" \

Seen in the metal-stack/v repository.

Kubernetes without Load Balancers?


All the hosted Kubernetes solutions I know of want you to pay roughly 10$ pre month for each load balancer.

If you currently don’t expect much traffic, but want to play around with k8s or if many docker-compose files don’t fit your needs anymore, this easily doubles your costs.

Downey.io – save money and skip the kubernetes load balancer

Bonus learning: I didn’t heard of the DaemonSet until now!

Kind is the new minikube


I have been playing around with minikube for quite some time now. Though as I run minikube on my Mac, I experienced multiple bugs regarding accessing the cluster and it’s published ports.

From my perspective Kind works much better, is faster, more stable on macOS and allows the creation of multiple clusters. Though it is not bug-free on macOS. Although most bugs seem to be related to Docker itself on the Mac.

You can even pause the cluster - just pause it’s docker container.

Bash scripts with Gum


I gave the newest tool of Charm Gum a try. It allows to create interactive bash scripts in just a few lines of code.

In my case I gave it a try for Kubernetes. I often want to look at the logs of a pod, but the exact k8s pod differs from time to time. And sometimes I forget the exact namespace or the pod’s name includes random characters.

#! /bin/bash

# let the user select a namespace
NAMESPACE=$(kubectl get namespaces -o name | gum choose | cut -d/ -f2)
# let the user select a pod of the namespace
POD=$(kubectl get pods -n "$NAMESPACE" | tail -n +2 | gum choose | cut -d' ' -f1)
# if you want to repeat, copy the command
echo "> kubectl logs -n \"$NAMESPACE\" \"$POD\""
# print the logs
kubectl logs -n "$NAMESPACE" "$POD"

Go 1.19 new Garbage Collection Memory Limit


Go 1.19 introduced a new option to customize the runtime Garbage Collection behavior: Memory Limit. This might be interesting when embedding Go within a mobile application.

Go Time – Episode #240: What’s new in Go 1.19

Extracting Tailwind constants using theme


When using tailwind, you might be forced to manually write SCSS by hand. With @apply some classes; you can embed whole classes with all their styles into your own rules.

But sometimes you need to only acces one single constant. Like accessing an animation timeout, default paddings, fonts or a color for some cases.

That’s possible with a simple theme('colors.primary').

Hugo Assets placed in Folders


If you need assets for a specific document or blog post, you can simply create a folder with your desired name and place your assets in there. Rename the markdown file to index.md.

To reference the asset, just link it relative to the folder [text](./my-file.ext).