Recent Docker BuildKit Features You're Missing Out On

Learn how to use BuildKit - the improved builder backend for Docker - that adds many new features to Docker, including new Dockerfile syntax, built-in debugger and more... | Continue reading


@martinheinz.dev | 3 days ago

Shell History Is Your Best Productivity Tool

If you work in shell/terminal often enough, then over time the history will become your personal knowledge vault, documentation and command reference. Being able to use this personal documentation efficiently can hugely boost your productivity. So, here are a couple of tips on ho … | Continue reading


@martinheinz.dev | 1 month ago

Everything You Can Do with Python's textwrap Module

Python has many options for formatting strings and text, including f-strings, `format()` function, templates and more. There's however one module that few people know about and it's called `textwrap`. This module is specifically built to help you with line-wrappin … | Continue reading


@martinheinz.dev | 3 months ago

Modern Git Commands and Features You Should Be Using

All of us - software engineers - use git every day, however most people only ever touch the most basic of commands, such as "add", "commit", "push" or "pull", like it's still 2005. Git however, introduced many features since then, and using them can make your life so much easier, … | Continue reading


@martinheinz.dev | 3 months ago

Monitoring Indoor Air Quality with Prometheus, Grafana and a CO2 Sensor

Low indoor air quality - or high CO2 - negatively impacts cognitive performance, causes headaches, drowsiness and more. It's easy to fix though, just use a CO2 sensor and open a window from time-to-time. But why stop there, when you can set up complete air quality … | Continue reading


@martinheinz.dev | 4 months ago

Everything You Can Do with Python’s bisect Module

While Python's `bisect` module is very simple - containing really just 2 functions - there's a lot one can do with it, including searching data efficiently, keeping any data sorted, and much more - and in this article we will explore all of it! | Continue reading


@martinheinz.dev | 6 months ago

You Don't Need a Dedicated Cache Service - PostgreSQL as a Cache

PostgreSQL can be more than just an SQL database. Why maintain a Redis or Memcached instance when you can just use PostgreSQL as a cache instead? | Continue reading


@martinheinz.dev | 7 months ago

A Collection of Docker Images To Solve All Your Debugging Needs

Whenever I troubleshoot anything container-related, I look for a good container image that contains all the right tools to troubleshoot and/or solve the problem. However, finding such an image, or assembling my own is time-consuming and honestly just way too much … | Continue reading


@martinheinz.dev | 8 months ago

Weird Python "Features" That Might Catch You By Surprise

From time to time, when coding, we all run into weird behaviours of the programming language. Sometimes it's a "feature" we weren't aware of, sometimes it's just quirky behaviour of the language, and sometimes it's borderline bug. Python - as any other programming … | Continue reading


@martinheinz.dev | 9 months ago

Lessons Learned From Writing 100 Articles

Couple days ago, I published my 100th article, so I feel like it’s time for reflections — looking at how I got there, what I learned along the way and whether it was actually worth the time and effort. As well as some thoughts on whether you should try writing too … | Continue reading


@martinheinz.dev | 9 months ago

Debugging Crashes and Deadlocks in Python using PyStack

There are certain bugs and issues that are very hard to troubleshoot. Just ask yourself, _"How would I debug deadlock, segmentation fault, crashing application, or a hanging process?" _ Now there's a tool to help you will all of that - _PyStack_ is a powerful new … | Continue reading


@martinheinz.dev | 10 months ago

Goodbye etcd, Hello PostgreSQL: Running Kubernetes with an SQL Database

etcd is the brain of every Kubernetes cluster, the key-value storage keeping track of all the objects in a cluster. It's intertwined and tightly coupled with Kubernetes, and it might seem like an inseparable part of a cluster, or is it? In this article we will exp … | Continue reading


@martinheinz.dev | 10 months ago

Remote Interactive Debugging of Python Applications Running in Kubernetes

Let's imagine a situation - you have multiple Python applications running on Kubernetes that interact with each other. There's bug that you can't reproduce locally, but it surfaces everytime you hit a particular API endpoint. If only you could attach to the remote … | Continue reading


@martinheinz.dev | 11 months ago

The Right Way to Run Shell Commands From Python

Python is a popular choice for automating anything and everything, that includes automating system administration tasks or tasks that require running other programs or interacting with operating system. There are however, many ways to achieve this in Python, most … | Continue reading


@martinheinz.dev | 11 months ago

Real Multithreading is Coming to Python - Learn How You Can Use It Now

Python is 32 years old language, yet it still doesn't have proper, true parallelism/concurrency. This is going to change soon, thanks to introduction of a "Per-Interpreter GIL" (Global Interpreter Lock) which will land in Python 3.12. While release of Python 3.12 … | Continue reading


@martinheinz.dev | 1 year ago

Python's Missing Batteries: Essential Libraries You're Missing Out On

Python is known to come with "batteries included", thanks to its very extensive standard library, which includes many modules and functions that you would not expect to be there. However, there are many more "essential" Python libraries out there that you should k … | Continue reading


@martinheinz.dev | 1 year ago

Kubernetes-Native Synthetic Monitoring with Kuberhealthy

When it comes to synthetic testing, engineers often rely on 3rd party platforms such as Datadog or New Relic that provide this type of monitoring. If you're running your applications and services on Kubernetes though, you can spin up synthetic monitoring platform … | Continue reading


@martinheinz.dev | 1 year ago

Make Your CLI Demos a Breeze with Zero Stress and Zero Mistakes

Running live demos can be stressful. You know what you want to say and show. You prepare the CLI commands you want to run to best showcase what you've built, but then you waste time typing long commands; you make typos; the commands fail or take way too long to co … | Continue reading


@martinheinz.dev | 1 year ago

Reduce - The Power of a Single Python Function

While Python is not a pure functional programming language, you still can do a lot of functional programming in it. In fact, just one function - `reduce` - can do most of it and in this article I will show you all the things one can do just with `reduce`. | Continue reading


@martinheinz.dev | 1 year ago

Why I Will Never Use Alpine Linux Ever Again

Nowadays, Alpine Linux is one of the most popular options for container base images. Many people (maybe including you) use it for anything and everything. Some people use it because of its small size, some because of habit and some, just because they copy-pasted a … | Continue reading


@martinheinz.dev | 1 year ago

Cgroups - Deep Dive into Resource Management in Kubernetes

There's a lot of "magic" that happens behind the scenes to make whole Kubernetes work. One of those is resource management and resource allocation done by Linux cgroups. In this article we will take a deep dive into what cgroups are, how Kubernetes uses them to ma … | Continue reading


@martinheinz.dev | 1 year ago

Dictionary Dispatch Pattern in Python

Have you ever written a long chain of if/else statements or a huge match/case block, with all statements just matching against a list of values, and wondered how could you make it more concise and readable? If so, then _dictionary dispatch_ pattern might be a tool … | Continue reading


@martinheinz.dev | 1 year ago

Boost Your Python Application Performance using Continuous Profiling

Continuous profiling is a great tool for optimizing the performance of applications. It allows us to continuously monitor and analyze application's resource usage, identify bottlenecks, and use resources more efficiently. In this article, we will take a look at ho … | Continue reading


@martinheinz.dev | 1 year ago

Lazy Evaluation Using Recursive Python Generators

We all are familiar with Python's generators and all their benefits. But, what if I told you that we can make them even better by combining them with recursion? So, let's see how we can use them to implement _"lazy recursion"_ and supercharge what we already do wi … | Continue reading


@martinheinz.dev | 1 year ago

Python Magic Methods You Haven't Heard About

Python's magic methods - also known as _dunder_ (double underscore) methods - can be used to implement a lot of cool things. Most of the time we use them for simple stuff, such as constructors (`__init__`), string representation (`__str__`, `__repr__`) or arithmet … | Continue reading


@martinheinz.dev | 1 year ago

Getting Started with Mastodon API in Python

With what's happening at Twitter, many people are considering moving to Mastodon. Like Twitter, Mastodon also offers an API that can be used to create many useful application, bots, to analyze data, respond to notification or simply post some statuses, and in this … | Continue reading


@martinheinz.dev | 1 year ago

Backup-and-Restore of Containers with Kubernetes Checkpointing API

Kubernetes v1.25 introduced Container Checkpointing API as an alpha feature. This provides a way to backup-and-restore containers running in Pods, without ever stopping them. This feature is primarily aimed at forensic analysis, but general backup-and-restore is s … | Continue reading


@martinheinz.dev | 1 year ago

Getting Started with Google APIs in Python

Google has literally hundreds of APIs, including ones for Gmail, Drive, Maps, Translation, Analytics and more. All of these share the same concepts like authorization, pagination or media uploads/downloads. In this article we will explore all of these concepts and … | Continue reading


@martinheinz.dev | 1 year ago

Python CLI Tricks That Don't Require Any Code Whatsoever

Continue reading


@martinheinz.dev | 1 year ago

All The Ways To Introspect Python Objects at Runtime

Python provides a lot of ways to ask questions about your code. Whether it's basic things like `help()` function, builtin functions like `dir()` or more advanced methods in `inspect` module - the tools are there to help you find the answers to your questions. … | Continue reading


@martinheinz.dev | 1 year ago

What is Python's "self" Argument, Anyway?

Every Python developer is familiar with the `self` argument, which is present in every* method signature of every class. We all know how to use it, but do you _really_ know what it is, why it's there and how it works under the hood? | Continue reading


@martinheinz.dev | 1 year ago

Python List Comprehensions Are More Powerful Than You Might Think

Python's list comprehensions (and generators) are an awesome feature that can greatly simplify your code. Most of the time however, we only use them to write a single `for` loop, maybe with addition of one `if` conditional and that's it. If you start poking around … | Continue reading


@martinheinz.dev | 1 year ago

You Should Be Using Python's Walrus Operator - Here's Why

The assignment operator - or "walrus operator" as we all know it - is a feature that's been in Python for a while now (since 3.8), yet it's still somewhat controversial and many people have unfounded hate for it. In this article I will try to convince you that the … | Continue reading


@martinheinz.dev | 1 year ago

Recipes and Tricks for Effective Structural Pattern Matching in Python

Continue reading


@martinheinz.dev | 1 year ago

It’s Time to Say Goodbye to These Obsolete Python Libraries

Continue reading


@martinheinz.dev | 1 year ago

Advanced Features of Kubernetes' Horizontal Pod Autoscaler

Scaling application on Kubernetes using _Horizontal Pod Autoscaler (HPA)_ based on their CPU or memory usage is pretty simple. There are however many more features of HPA that you can use to customize scaling behaviour of your applications using external/custom me … | Continue reading


@martinheinz.dev | 1 year ago

Data and System Visualization Tools That Will Boost Your Productivity

Continue reading


@martinheinz.dev | 1 year ago

Stop Messing with Kubernetes Finalizers

Continue reading


@martinheinz.dev | 1 year ago

Goodbye, Google Analytics - Why and How You Should Leave The Platform

With the recent events relating to _Google Analytics_ platform, it's becoming very clear that the time has come for many of us to migrate from Google Analytics to different platforms. In this article we will go over both the _"Why?"_, so that you can make an infor … | Continue reading


@martinheinz.dev | 2 years ago

Python f-strings Are More Powerful Than You Might Think

Formatted string literals - also called _f-strings_ - have been around since Python 3.6, so we all know what they are and how to use them. There are however some facts and handy features of f-string that you might not know about. So, let's take a tour of some awes … | Continue reading


@martinheinz.dev | 2 years ago

Ultimate CI Pipeline for All of Your Python Projects

Every project can benefit from a robust continuous integration pipeline that builds your application, runs tests, lints code, verifies code quality, runs vulnerability analysis and more. However, building such pipeline takes a significant amount of time, which doe … | Continue reading


@martinheinz.dev | 2 years ago

Optimizing Memory Usage in Python Applications

Continue reading


@martinheinz.dev | 2 years ago

Python Pitfalls – Expecting the Unexpected

Continue reading


@martinheinz.dev | 2 years ago

Optimizing Memory Usage in Python Applications

When it comes to performance optimization, people usually focus only on speed and CPU usage. Rarely is anyone concerned with memory consumption, well, until they run out of RAM. There are many reasons to try to limit memory usage, not just avoiding having your app … | Continue reading


@martinheinz.dev | 2 years ago

Upcoming Python Features Brought to You by Python Enhancement Proposals

Before any new feature, change or improvement makes it into Python, there needs to be a _Python Enhancement Proposal_, also knows as PEP, outlining the proposed change. These PEPs are a great way of getting the freshest info about what might be included in the upc … | Continue reading


@martinheinz.dev | 2 years ago

Upcoming Python Features Brought to You by Python Enhancement Proposals

Welcome to my personal website and blog, here you can find some information about me, contact, social media links as well as my blog posts | Continue reading


@martinheinz.dev | 2 years ago

Creating Beautiful Tracebacks with Python's Exception Hooks

Continue reading


@martinheinz.dev | 2 years ago

Creating Beautiful Tracebacks with Python's Exception Hooks

We all spend a good chuck of our time debugging, sifting through logs or reading tracebacks. Each of these can be difficult and time-consuming and in this article we will focus on making the last one - dealing with tracebacks and exceptions - as easy and efficient … | Continue reading


@martinheinz.dev | 2 years ago