Welcome to NucuLabs 👋

A blog about Programming, Cloud and Engineering! 👨‍🔬; (Blogging consistently since 2018)

Testing Tips: Avoid sleep in tests

Hi 👋, In this article I wanna show a testing tip that I’ve recently learned myself by reading Software Engineering at Google: Lessons Learned from Programming Over Time. The technique improved the way I write unit tests. When I’m writing bigger unit tests, I have execute something in the background, like for example publishing a message to a message broker, wait for the message to be published and then consume it to test that what I published is correct. ...

July 12, 2022 · 4 min · Denis Nuțiu

How to install Redis on Synology NAS (Container Manager)

Hello everyone! 👋 I run a small set of containers on my NAS at Home to monitor different weather and run automations. Because of this I wanted to install Redis on my NAS as well. Redis is a key value database that has a lot of extra modules such as: Redis Search: A query and indexing engine for Redis, providing secondary indexing, full-text search, vector similarity search and aggregations. Redis JSON: A NO-SQL Document Database Redis Graph: A graph database. Redis TimeSeries: A time series database. Redis Bloom: Bloom and Cuckoo filters implementation. Redis Streams: An append only Log These functionalities save me a lot of time and improve my software running inside my home. Redis is also a simple service to deploy and maintain. ...

December 16, 2024 · 1 min · Denis Nutiu

How to install DaVinci Resolve on Linux (Fedora Edition)

Hello everyone! 👋 In this article you will learn how to install DaVinci Resolve Free and Studio editions on Fedora 40 and Fedora 41. The first step is to download DaVinci Resolve from the official website, either with: Free Edition Studio Edition The next step is to download and install DaVinci Helper. 1 2 sudo dnf copr enable -y herzen/davinci-helper sudo dnf install -y davinci-helper Once you’ve installed DaVinci Helper, the following steps are simple. Simply circle through the tabs to on the left and select the DaVinci Resolve zip file when prompted. ...

November 30, 2024 · 1 min · Denis Nutiu

The Go *Options pattern

Introduction Hello everyone! 👋 In this article I’ll present you the options pattern in Golang. The pattern is useful when you want to create a function that takes different parameters as an option. Code Study: Building a rocket The following code defines a Rocket struct with 3 fields and a NewRocket function which builds an instance of the Rocket. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // Rocket models a rocket. type Rocket struct { name string nose Nose fuelCapacity int } // NewRocket returns a new rocket instance. func NewRocket(name string, nose Nose, fuelCapacity int) Rocket { return Rocket{ name: name, nose: nose, fuelCapacity: fuelCapacity, } } To use the NewRocket function one would have to write something like this: ...

November 26, 2024 · 4 min · Denis Nutiu

The Hash Set

Introduction A hash set is a data structure that allows storing elements inside a set using a hash function. The set is a data structure that offers efficient access to its elements and does not allow duplicates. The uniqueness of an element in the hash set is determined by the hash function, in this implementation hash collisions are not handled. If the hash of “a” is 123 and the hash of “b” is 123 as well then we consider “a” and “b” to have a hash collision and if “a” is already present in the set adding “b” has no effect. ...

September 15, 2024 · 4 min · Denis Nutiu

Changing Microk8s' default hostpath addon storage location

Hello everyone, This is a short guide on how to change Microk8s’ default storage path for the hostpath addon. First, ensure the addon is enabled: 1 microk8s enable hostpath-storage Then create a new directory in which you want to store volumes created in the Microk8s instance. 1 mkdir -p /var/microk8s-volumes Then create and apply the storage class yaml file: 1 2 3 4 5 6 7 8 9 kind: StorageClass apiVersion: storage.k8s.io/v1 metadata: name: custom-storageclass provisioner: microk8s.io/hostpath reclaimPolicy: Retain parameters: pvDir: /var/microk8s-volumes volumeBindingMode: WaitForFirstConsumer To change the default storage class for Microk8s you need to run these commands: ...

August 9, 2024 · 1 min · Denis Nutiu

Ranking: BM25+

Introduction The BM25+ is a ranking algorithm used to rank text documents based on a relevance score. It is used in search engines to determine which documents are the most relevant given a terms query. The algorithm implemented is based on the Improvements to BM25 and Language Models Examined paper. Implementation An index can be used to index the terms and the documents in which the terms occur: 1 2 [term: apples] - doc1, doc2, doc3 [term: grapes] - doc2, doc4 When a user queries using the apples term then doc1, doc2 and doc3 is returned. To score doc1, doc2 anddoc3 based on relevance the BM25+ algorithm is used. ...

June 3, 2024 · 3 min · Denis Nutiu

The Linked List

Introduction A linked list is a fundamental data structure which consists of Nodes that are connected to each other. Other variations are: Double linked list Circular linked list (circular buffer) The Singly Linked List To visualize the data structure, if you want to store two integers 10 and 20 you will have a 2 node linked list that will have: [Node 1, Value 10] -> [Node 2, Value: 20] -> [null] ...

April 17, 2024 · 5 min · Denis Nutiu

A Rust library for for BME-680

https://github.com/dnutiu/bme680-rust

March 14, 2024 · 1 min · Denis Nutiu

Cancellation Token Pattern in Python

Hello! 👋 The Cancellation Token Pattern article is a pattern inspired by C#’s CancellationToken struct and Golang’s context package. The main idea of the pattern is to allow the user of an API to cancel its operations, but in order for this pattern to work, the API must be written with the cancellation token pattern in mind. To use the pattern, you need a class that represents a cancellation token. Here’s my simple version: ...

March 9, 2024 · 3 min · Denis Nutiu