đź“Ś Concurrency in a Single Thread

Note: An mdbook version, organized into chapters, can be found here. Its content is licensed under CC (Creative Commons), and if you want to modify it to fit it for your own use, you can use the GitHub repository. Outline Concurrency in a single thread Generators Coroutines Scheduling coroutines Concurrency in a single thread Traditionally, concurrency has been a responsibility handed down to the operating system. A single process can create multiple threads and the OS will run these threads across its (multiple) cores as it sees fit. It will interrupt a running thread, store its state, and load another previously interrupted thread for the computer to work on. ...

April 21, 2023

Trying the i3 window manager

I recently tried the i3 window manager.

June 1, 2024

Vim

I started Vim several years ago. My first deliberate learning came one random day when I had some free time and had recently learnt that Vim tutor exists. I completed the exercises. The idea of using a keyboard to do complicated editor actions - things like skipping through the start and end of English words, going to the beginning and end of lines, skipping to the next empty line - felt powerful. I have since then, through recommendations, been a full Neovim user. I would hate being in a world that doesn’t have Vim navigation. I felt compelled to install Vimium in the browser too. ...

April 14, 2024

Google Summer of Code 2023 at Postgres

For easy access GitHub Repo: the4thdoctor/pg_chameleon GitHub Diff: 50ed941…bdc376a Branch with my changes: gsoc-2023 (This can be installed and run manually) Changes after GSOC: Pull Request This post is to mark the completion of my participation in Google Summer of Code 2023 with the PostgreSQL organisation. I worked on a database replication tool called pg_chameleon, to rewrite the SQL parsing library. My mentors were Federico – the original author of this library –, and Andreas – a PostgreSQL contributor. ...

August 28, 2023

Creative Coding in Python with Joy

August 27, 2023

Syntactics and Semantics

I don’t usually do purely mathematical posts, but this topic really fascinated me and I want to share it. If you think about it, math is formal language we created to help us describe the world. It is extremely rigorous and in the end, and very importantly, it seems to make sense to us. In the early 1900s, Bertrand Russell worked on Principia Mathematica, a set of rigorous proofs of what we consider fundamental truths in math. For example, their proof for 1 + 1 = 2 was 360 pages long! This is way too rigorous for something that we would consider obvious. But this now is the perfect segue for me to introduce the terms syntactics and semantics. ...

August 11, 2023

Idiomatic Python in 2023 and Up

Work In Progress 🚧 2023 marks the year that the 12th minor version of Python 3 will be released. Things have changed a lot since the early days. Features have been added, deprecated, and new pythonic ways have emerged. The Pythonic Ways To preach about pythonic ways to preach the Zen of Python. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 >>> import this The Zen of Python, by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! >>> The Zen of Python contains the tenets that budding pythonistas secretly meditate to, attempting to uncover the deeper meaning of each one until they have internalised it enough to start preaching the same to others. ...

August 5, 2023

Protohackers in Rust

I’ve been learning Rust and I thought the Protohackers challenge would be a good way to learn it. Here I document my thoughts and learnings as I go through it. [It’s a WIP] Problem 0: Smoke Test A TCP Echo server. Before thoughts: A TCP server must be fairly straightforward. If I remember correctly, the way to do it with sockets is to listen on one socket, pass received connections onto other separate sockets for each such that each connection is handled asynchronously, and then keep listening for more connections on the original listening socket. ...

June 18, 2023

(A week after my) last day at Pipal

The previous week was my last at Pipal Academy. I completed all the handoffs at the start of the week and then I had to use the rest of the week to prepare for some online exams over the weekend. It felt like a tiring week so I took some days to wind down, travel back home, and I’m only writing this post now. It’s been slightly more than a year since I joined Pipal. Throughout my time, a lot of emphasis was placed on keeping software simple. This means not just caring about the simplicity of the code, but also the infrastructure and the developer experience we give to our future selves. All of it is secondary to user experience, but it is still important in making sure you spend your time on the right problems. Things such as setting up CI/CD early, building simple but consistent internal APIs, and using the right tool for the right job. ...

June 16, 2023

The Curious Case of a Ghost in CI

I don’t believe in ghosts. But something spooky happened to me only a few minutes ago, and sitting in the melancholic darkness of 3AM, I couldn’t think of a more fitting name than “The Ghost in the CI.” It started with a change I made in the HTML template of a Flask app. This app spawns some other apps on-demand with Nomad (which has similar capabilities as Kubernetes). The app accesses Nomad through a third-party wrapper library for the API. This library has a method to get the status of a deployment. The app calls this method as part of a health check for the deployed app during the tests. This method shouldn’t ever return None as per the source code. But it did. My code didn’t handle that case and it crashed. ...

May 23, 2023