Working with Volumes in Microk8s

Introduction Hello 👋, In this quick tutorial 💻 we’ll explore how to use Volumes and PersistentVolumes with hostpath storage in Microk8s. We will deploy a simple nginx instance and mount a volume inside it that points to the ~/Downloads folder. Let’s get started! Note: The following image was generated with Stable Diffusion How-To You can follow along if you want to setup a quick deployment with a host path volume....

April 13, 2023 · 2 min · Denis Nuțiu

LeetCode: Removing Stars From a String & Simplify Path

Hello 👋, I’ve started doing some LeetCode dailies with Paula and I’d like to share our solutions for the last two problems. https://leetcode.com/problems/removing-stars-from-a-string/ https://leetcode.com/problems/simplify-path/ I also want to warmly welcome the new nuculabs.dev subscribers! Thank you for subscribing! If you want to attempt the problems by yourself then stop reading otherwise you’ll be spoiled with solutions. Removing Stars From a String In this problem you are given a string with stars ‘*’ and when you encounter a start you’ll need to remove the start along with the character to it’s left....

April 12, 2023 · 2 min · Denis Nuțiu, Paula Rusti

LeetCode: Boats to Save People

Introduction Hello everyone! 👋 I’ve been practicing with some Leetcode daily challenges lately and since I’ve recently moved to Substack I wanted to make my first post here 😁 Boats to Save People The problem Boats to Save People is solved using a Greedy approach. Given a number of people and their weights, along with a carry limit for the boat. You must find the number of boats needed to carry the people....

April 8, 2023 · 2 min · Denis Nuțiu, Paula Rusti

How to Pack JavaScript Array Elements into a Byte Buffer and Create a New Numeric Array from the Buffer

Hello 👋, In this short article we’ll talk about packing integers into binary data in JavaScript using the Buffer, ArrayBuffer and DataView classes. Sometimes in JavaScript, it may be necessary to pack the elements of an array into a byte buffer and then create a new numeric array from the buffer’s contents. This can be achieved using the DataView object in JavaScript. First, create an array of elements you want to pack, for example:...

March 30, 2023 · 3 min · Denis Nuțiu

How to create a ServiceMonitor in Microk8s: Observability Tutorial

Hello, In this quick tutorial we will explore how to create a ServiceMonitor in microk8s when you have the observability addon enabled. When you enable the observability addon with: microk8s enable observability It will create the obserability namespace and install the Kubernetes Prometheus Stack. k get pods -n observability NAME READY STATUS RESTARTS AGE kube-prom-stack-prometheus-node-exporter-htzw9 1/1 tempo-0 2/2 Running 4 (16h ago) 27h alertmanager-kube-prom-stack-kube-prome-alertmanager-0 2/2 kube-prom-stack-kube-prome-operator-cbf896985-fb5fc 1/1 kube-prom-stack-kube-state-metrics-57c8c84df6-hflgj 1/1 kube-prom-stack-grafana-74d8979894-sjv77 3/3 prometheus-kube-prom-stack-kube-prome-prometheus-0 2/2 loki-0 1/1 loki-promtail-sg8bv 1/1 Running You will get a Grafana configured with a Prometheus data source and other data sources as well....

March 29, 2023 · 2 min · Denis Nuțiu

Parallel Processing in Python with concurrent.futures

Hello 👋, In this short article I want to talk about parallel processing in Python. Introduction Sometimes you will need to process certain things in parallel. If you’re using Python you may know about the global interpreter lock abbreviated GIL for short. The GIL is a lock that allows only a single thread to control the Python Interpreter at a time (per process), that means that your multi-threaded Python program will have only a single thread executing code at the same time....

March 18, 2023 · 3 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 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....

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

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

November 19, 2022 · 1 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