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....

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....

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

Using confluent-kafka-go on MacOS M1

Hello, TLDR; 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....

October 17, 2022 · 2 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 hash("white_cat") = "aaaa" hash("brown_cat") = "aaba" hash("car") = "xkjwe" Some use cases for image hashing are: Duplicate Image Detection Anti-Impersonation / Image Stealing Image filtering Reverse image search Let’s play around with image hashing techniques using Python and the ImageHash library....

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. 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 · 5 min · Denis Nuțiu

HTTPClients are reusable

Hi 👋, I wanted to write this article to tell you that instantiating a HttpClient class is often a costly operation. If you have a method that does something like: public class Main { static void myMethod() { HttpClient client = new HttpClient() // do stuff } } You should refactor it ASAP. Either move the HttpClient into the class and perhaps ensure that the class is a Singleton or retrieve the HttpClient instance using an Object Pool pattern like the HttpClient class from System....

June 23, 2022 · 1 min · Denis Nuțiu

Go Pattern: Sorting a slice on multiple keys

Hi 👋 In this article I want to highlight a simple pattern for sorting a slice in Go on multiple keys. Given the following structure, let’s say we want to sort it in ascending order after Version, Generation and Time. type TheStruct struct { Generation int Time int Version int } The way we sort slices in Go is by using the sort interface or one of the sort.Slice functions. To sort the slice after the above criteria we’ll call slice....

May 12, 2022 · 2 min · Denis Nuțiu

Multiple Python versions on Windows

Hi 👋 In this short article I will show you two ways of changing Python versions on Windows. It is useful when you have installed multiple Python versions on your system and want to run a specific version from the terminal. For example, if we have the following versions installed: We can use either the Python Launcher py to run Python or the python command. Python Launcher To list installed Python versions with Python launcher we can use the py -0 command....

April 8, 2022 · 2 min · Denis Nuțiu

A custom HomeKit accessory with Python

Hi 👋, In this short article I want to showcase how I implemented a custom HomeKit accessory with python. My Home Assistant’s SD card died 🪦 a few days ago and the support for GPIO based sensors will be removed in newer releases. This makes it unsuitable for my needs, while giving me the perfect opportunity to try other things. To continue monitoring temperature and humidity in my home I’ve built a custom HomeKit accessory with HAP Python....

March 11, 2022 · 3 min · Denis Nuțiu