Python Singleton Pattern implementation with LRU

Hello and happy new year! 🥳🙌 I’ve made a video on how to implement the singleton pattern in Python using the LRU cache. Thank you!

January 7, 2023 · 1 min · Denis Nuțiu

How to fix DaVinci Resolve audio issues on Ubuntu 20.10

Hello 👋, To fix audio issues on a fresh install of DaVinci Resolve 18 on my Ubuntu 20.10 PC I did the following things: 1. List all the available sound cards 1 2 3 4 5 6 7 8 9 cat /proc/asound/cards 0 [NVidia ]: HDA-Intel - HDA NVidia HDA NVidia at 0xfc080000 irq 94 1 [AI1 ]: USB-Audio - RODE AI-1 RODE Microphones RODE AI-1 at usb-0000:2d:00.3-1.3, full speed 2 [Generic ]: HDA-Intel - HD-Audio Generic HD-Audio Generic at 0xfc400000 irq 96 3 [U0x46d0x81b ]: USB-Audio - USB Device 0x46d:0x81b USB Device 0x46d:0x81b at usb-0000:2d:00.3-1.4, high speed List all the available sound cards a chose a default. I like playing audio though my headphones when editing and the headphones are connected to my USB Audio Interface RODE AI-1, this is what I want to use as the default card. ...

December 11, 2022 · 2 min · Denis Nuțiu

Separate Audio from Video (with ffmpeg)

Hello 👋 In this short article I will show you how to split audio from video using ffmpeg. When I worked on my Udemy course I needed a way to process audio in Audacity and edit the video in Kdenlive. So I wrote two bash scripts, one for spliting audio and video and another one to combine the processed audio (usually a .wav file with the same name) with the video. The result is the following ...

December 8, 2022 · 1 min · Denis Nuțiu

Exec as root user in Kubernetes

Hi 👋, In this short tutorial I will show you a way of getting a root shell in containers running inside a modern Kubernetes cluster. Prerequisites: Root access to the cluster node in which the container is running. Problem Statement We wan’t root access into a running container, exec gives us non-root user. 1 2 3 4 5 6 7 8 9 10 ➜ Downloads k get pods NAME READY STATUS RESTARTS AGE my-release-cassandra-0 1/1 Running 0 2m9s ➜ Downloads k exec -it pod/my-release-cassandra-0 -- /bin/bash I have no name!@my-release-cassandra-0:/$ whoami whoami: cannot find name for user ID 1001 I have no name!@my-release-cassandra-0:/$ touch test touch: cannot touch 'test': Permission denied I have no name!@my-release-cassandra-0:/$ Solution To obtain root access. First grab the Container ID from inside the pod. ...

November 19, 2022 · 2 min · Denis Nuțiu

Apache Flink Checkpoints on S3 and S3 compatible storage

Hello, Recently someone working at Yahoo emailed me regarding an old thread I’ve started on the Apache Flink user mailing list. I’ve replied to the e-mail but also decided to turn the reply into a blog post, because it might help other people as well. Email Hi, I was able to get it working after tinkering with it. The issue was mainly a miscommunication, we didn’t formally know which authentication method we were using in AWS. We we’re using only s3:// ...

October 28, 2022 · 2 min · Denis Nuțiu

envsubst – Substitute Variables for Environment Variables

Hi 👋, Introduction In this short article I want to showcase a nice and useful Linux command. The comand 🥁 envsubst 🥁. In short it Substitutes the values of environment variables. It’s great for populating configuration files with values from environment variables, a common operation for developers containerizing their applications. Example Usecase Let’s say we are containerizing an application and we have the following file configuration.yaml, and we want to modify the values of the environment field and the log_level field without adding the additional complexity of mounting the configuration.yaml file into the container/pod. ...

October 23, 2022 · 2 min · Denis Nuțiu

Using confluent-kafka-go on MacOS M1

Hello, TLDR; 1 2 3 brew install librdkafka openssl@3 pkg-config export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig" go test -tags dynamic ./... I’ve been transition from a Linux machine to a MacOS M1 machine at work and when I ran tests for a Golang project, I noticed that the test failed on modules depending on librdkafka. Initially I’ve had problems with Kafka on MacOS M1 on Docker, since I was using an older image version that didn’t have any arm64 build, updating to images to version 7.2.1[1] fixed the issues. ...

October 17, 2022 · 3 min · Denis Nuțiu

How to identify similar images using hashing and Python

Hi 👋, In this article I would like to talk about image hashing. Image hashing algorithms are specialized hashing functions that output the hash of an image based on the image’s properties. Duplicate images output the same hash value and visually identical images output a hash value that is slightly different. To simplify 1 2 3 hash("white_cat") = "aaaa" hash("brown_cat") = "aaba" hash("car") = "xkjwe" Some use cases for image hashing are: ...

September 21, 2022 · 4 min · Denis Nuțiu

DeMorgan’s Law

DeMorgan’s law is a simple law that I learned at UPT during one of my hardware classes. While it is useful in hardware it, it is also useful when writing programs. If you have a condition like not (A and B), you can rewrite it to !A or !B. 1 2 3 4 5 6 7 8 9 10 11 12 13 if __name__ == '__main__': a = True b = True if not (a and b): print("True") else: print("False") if not a or not b: print("True") else: print("False")

August 25, 2022 · 1 min · Denis Nuțiu

Object Pool Pattern

Hi 👋 In this article we’ll talk about the Object Pool pattern in Golang. The Object Pool pattern is a design pattern used in situations when constructing objects is a costly operation, for example building an HTTPClient or DatabaseClient object can take some time. By having a pool of resources, the resources are requested from the pool when needed and then returned when not needed so they can be reused later. ...

August 21, 2022 · 6 min · Denis Nuțiu