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. ...
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. 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. ...
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. // 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: ...
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. ...
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: microk8s enable hostpath-storage Then create a new directory in which you want to store volumes created in the Microk8s instance. mkdir -p /var/microk8s-volumes Then create and apply the storage class yaml file: 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: ...
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: [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. ...
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] ...
A Rust library for for BME-680
https://github.com/dnutiu/bme680-rust
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: ...
How to install HP LaserJet 107a Drivers on Linux
Hello everyone! 👋 I’ve recently installed Fedora on my main PC and I wanted to write this post to serve me as a memo on how to install the HP LaserJet 107 printer driver. The driver should also be compatible with the following products and generally HP’s LaserJet 100 printer series. HP LaserJet 107a HP LaserJet 105a HP LaserJet 103a Installing the Drivers Installing the drivers requires Python3 available on your system if I remember correctly, it should be already available on Fedora and Ubuntu. ...