fileName="my-file.yaml"
find . -type f -name "$fileName" -printf "%h\n"
Managing Multiple Kube Config Files
This is a simple script that takes multiple kube config files and deeply merges them into one.
Tip
I’ve since switched to kubeswitch, which works much cleaner than this home-grown script.
Working With Dates in Bash and Other Shells
Often times we need the current date (and time) when scripting inside bash or other shells. For example when creating a backup file or writing to a log.
[Read More]Wait for Port to Close Using Ansible
Sometimes it is useful to wait for a port to be closed, for example when updating an app that can’t always properly be shut down using other Ansible modules.
This can easily be achieved using the ansible.builtin.wait_for
or ansible.builtin.win_wait_for
module.
PicoCSS
My preferred minimalistic CSS framework, which is usually enough for small websites and even simple SaaS apps. It feels like a super power to write almost plain HTML and get something that looks presentable, supports dark mode and has just enough components to cover most use cases for me.
Navigate to Script Directory
Often times when writing scripts I want to reference files in the same directory, but keep the script portable in case it is part of a git repository being checked out somewhere else or just the folder getting moved.
[Read More]My First Show Hacker News
Experiences & Statistics
Show Size of Elements Using JavaScript
I was recently doing a lot of layouting pages to later be printed, so showing how big certain elements are was of help to me.
This is a JavaScript function that does just that.
[Read More]Spread Elements Vertically Using CSS
Using flex
children can easily be positioned vertically in their parent container.
Debugging CSS Layouts
When debugging issues with CSS layouts it can sometimes be tricky to really understand what is going on.
[Read More]Simple Copy Button Using JavaScript
I often find myself wanting a simple copy button in my web projects.
This is the recipe I build them from using clipboard.js and a couple lines of JavaScript.
[Read More]Generate link in plain text element using JavaScript
Sometimes, when working with externally generated content you might want to make links clickable when rendering it in the client.
This is a snippet to do just that.
[Read More]Debugging Container Workloads
A helper container
Debugging container workloads can be a challenge sometimes, especially when running them in k8s, behind a reverse proxy or in other, possibly complex, traffic flow scenarios.
[Read More]Register all models with Django admin
Sometimes, mostly when throwing together a quick idea or MVP, it can be useful to just register all models with the admin and leave proper customization for later.
[Read More]Add fields to list with Kustomize
How to add things to a list using kustomize. This is useful for example when you need to patch additional environment variables into a pod.
[Read More]CLI fuzzy search
I often whish to search through large bodies of text, like my knowledge base or source code repositories, from the command line.
I use fuz for this and I’m quite happy with it.
I also have it aliased to my knowledge base folder for even easier searching.
alias search="fuz -p /path/to/knowledge-base/"
Copy & Paste Is Dangerous
Copy & paste from untrusted sources on the internet into the terminal is a really bad idea! Early in my career I did it too and still often see others doing it.
[Read More]Render Plain HTML with Hugo
Hugo is my favorite tool for publishing markdown to the internet, but sometimes I want to do something a little bit more advanced with my posts.
With this shortcode I can always just fall back to plain old HTML.
[Read More]Hugo Details Shortcode
The HTML details element is a nice way to create natively expandable content with wide browser support.
[Read More]Ansible and cowsay
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]