Memory Management

Modern programming languages that we work with these days have made memory management simpler that ever, they manage it on their own using things like garbage collectors, smart pointers, ownership, etc. Creating an empty vector is as simple as let empty_vec: Vec<i32> = Vec::new(); But some questions remain unanswered if you haven’t tried manually doing memory operations like: how is a sized vector created using Vec::with_capacity? how is a vector resized on calling pop_back or push_back?...

September 8, 2024 · 7 min · 1419 words · Lakshya Singh

Git Worktree

When you are working in a large code base comprising of multiple micro services maybe in a single repository your work would require you to make progress on multiple features simultaneously. There comes in a lot of context switching which in git terminology means multiple branches. The flow can become cumbersome when you keep stashing and checking out. Let’s see how that looks like. What is the problem? Let’s say I am working on a long term new feature in my freshly checked out branch lakshyasingh/feature-python....

September 1, 2024 · 5 min · 1020 words · Lakshya Singh

MLFQ CPU Scheduling

Multi-Level Feedback Queue algorithm was designed to address problems associated with existing scheduling algorithms i.e. providing a good response and turnaround time resulting in a balanced scheduling algorithm which can cater to a general purpose CPU requirements. It can do so without needing to have any prior information about the executing processes. It develops its knowledge about them on the fly and hence modifying its approach on how to share the CPU time between them....

July 8, 2024 · 6 min · 1221 words · Lakshya Singh

OpenTelemetry Signals

Observability is the ability to measure the internal states of a system by examining its outputs. A good observability system allows to easily identify problem source and troubleshoot them. Observability extends the concept of monitoring by not just telling when something goes wrong but also providing information about why and how. OpenTelemetry is an open standard for telemetry collection that was created as a successor to previously existing standards OpenTracing and Opencensus by Cloud Native Computing Foundation (CNCF)....

July 3, 2024 · 6 min · 1156 words · Lakshya Singh

Reversing Wheel File

Let’s talk about wheel today, definitely hoping it was a ferris wheel but its going to be python’s wheel for now. A wheel file is a relocatable package format for distribution of python packages for easy, quick and deterministic installations. All the packages published on pypi have under their Download files section a tar file and whl file. For example you can head over to Django and download its wheel file which can then be installed simply by doing...

June 14, 2024 · 4 min · 744 words · Lakshya Singh

Beautiful Code

Let’s first try to answer what is software design? From a very basic definition “its the relationship between elements of our software”. Now, the part about good software design is that it creates relationship that provide benefits in terms of cost associated with making changes to system and its overall working. The biggest cost of code is the cost of reading and understanding it, not the cost of writing it....

April 13, 2024 · 8 min · 1537 words · Lakshya Singh

docker run vlsd

Hey you! Yes, you Lightning dev! We heard you were worried about the safety of your user’s funds stored on your Lightning node. It’s a hot wallet after all, and we all know that’s a big no-no for storing large sums of satoshis. That’s why VLS exists. VLS separates Lightning private keys and security rule validation from the Bitcoin Lightning node to a separate, secure signing device. What’s that? “Sounds great, how do I start?...

February 29, 2024 · 4 min · 774 words · Lakshya Singh

VLS - Summer of Bitcoin 2023

I had previously completed Google Summer of Code | 2021 and Linux Foundation Mentorship | 2021 two highly renowned open source programs which paved my path towards excellence as a software developer. I chose open source for reasons I have highlighted in Collaboration not Competition but it brought so many other good things along with it like learning, friends, experience, connections, etc. There was one space which was left for me to explore with open source, Bitcoin....

February 25, 2024 · 9 min · 1742 words · Lakshya Singh

Rate Limiting

Why to Rate Limit? Rate Limiting is a crucial part of designing any API it maybe private or public. A rate limiter caps how many requests a sender can issue in a specific window of time. A rate limiter provides following features: Defense against a Denial of Service from malicious actors trying to pull down the service. Ensures the load on servers is always under maintainable state by discarding too many requests....

February 11, 2024 · 5 min · 1037 words · Lakshya Singh

Union/Sum Type

Let’s take an example of operating system information as a data structure to better understand sum types. Struct Our bare minimum struct to represent an operating system contains a few common fields that would exist in each of the operating system. typedef struct { char organization[]; int releaseYear; float version; int is_opensource; } os; It’s missing one thing though the type of operating system like macOS, linux, windows, etc. Enum We will add in a new field into our structure to represent the type of operating system by using an enum....

January 20, 2024 · 7 min · 1301 words · Lakshya Singh