RSSAmplifier

Blog

Zakaria Amine's blog

blog about software engineering and open source

zakariaamine.comRSS feed ↗10 posts

Latest posts

playing with buffering modes in stdio.h

I was recently debugging a crashing program written in C using printf statements. I noticed that even if some printf statements executed before the crash, there was no output. I remembered something I read about stdio (the C standard I/O library) using buffering top of the read and write system calls to increase efficiency. I am writing this post as a reminder to my future self 😅 setvbuf and the…

Debugging bash scripts

Unlike many programming languages, shell(bash) scripting has no official tool for debugging. Besides the classic “prints”, I was not aware that bash has some built-in mechanisms for tracing, until I decided to “read the manual”. As I was struggling with understanding some large shell scripts (that I did not write myself), I found some valuable information just by running man bash . To my surprise,…

Have you heard of Heap's algorithm

I recently encountered a problem on HackerRank named “Bigger is Greater”: https://www.hackerrank.com/challenges/bigger-is-greater/problem . The problem statement is as follows: given a string, the solution program needs to find the smallest of all the string permutations which is bigger than the string itself. In case no solution that match the criterias is found, no answer is to be returned.…

Resolving cert-manager HTTP-01 challenge behind a Hetzner load balancer

If you are running Kubernetes on the top of Hetzner cloud, you may have encountered an annoying issue when trying to obtain a TLS certifcate for a domain through the cert-manager operator. The issue manifests as follows: a certificate request is created by cert-manager a related challenge object is created cert-manager an ingress path is created to allow the acme server to verify the challenge…

Solving Flatland Space Stations on HackerRank: Golang vs Python

Solving programming puzzles is a good way to get reminded of software engineering fundamentals like algorithms and data structures. For this reason, I try to pick up a programming puzzle on HackerRank or leetcode from time to time. Lately, I stumbled upon a problem named Flatland Space Stations on HackerRank: https://www.hackerrank.com/challenges/flatland-space-stations/problem . The puzzle is…

adding default values to github.com/gorilla/schema

Around July 2021, I made a proposal to add a new functionality to github.com/gorilla/schema library: the possiblity to set default values when the target struct field value is nil or is not set. For those who don’t know, schema library is a dead simple util library that gives you the ability to encode/decode anything of type url.Values to/from a golang struct, in the same spirit as the well famous…

Helm contribution note: fixing post install hook deletion failure due to before-hook-creation policy

After over one year and 4 months, I was happy to see the PR #11387 that I have submitted to the helm project finally accepted and merged. I would like to take the opportunity to explain what problem did my contribution solve. It all started after this error: Error: failed post-install: warning: Hook post-install testing-hooks-chart/templates/pod.yaml failed: object is being deleted: pods…

a Kubernetes Operator for renewing ECR credentials cluster wide

If you have used AWS ECR service (AWS container registry) before, you must be already aware that the registry credentials are only valid for 12 hours. It can be seen as a plus from the security perspective, but from a user/developer experience perspective, it can be annoying, especially if you are running your containers in Kubernetes. To make sure that the registry secret have not expired, one…

I survived a disastrous upgrade from Ubuntu 20.04 to 22.04

Last time I upgraded Ubuntu from 18.04 to 20.04, I almost swore I will never upgrade again. I encountered a kernel issue which prevented the pc from booting up. The situation was so stressful that I did not take any note or screenshots of the error messages, but I recall vaguely that the issue was related to “too many” versions of the Linux kernel being present at the same time. I solved it by…

ArgoCD & helm: help, my configmap keeps on getting reset!

I needed recently to track an issue with a kubernetes configmap that was reset after each ArgoCD (continuous delivery for Kubernetes) synchronization. I have to say that I am fairly new to the ArgoCD ecosystem (as off the time this post is written) and the issue was mainly due the lack of understanding of how ArgoCD works with helm. An additional factor that led to the issue is the fact that the…