Sivaram Konanki

February 10, 2025

Deferred tasks in Rust

Annotated version use std::time::Duration; use color_eyre::eyre; struct Deferred<T: FnOnce()> { task: Option<T>, } impl<T: FnOnce()> Deferred<T> { fn abort(&mut self) { println!("I AM ABORTING"); self.task.take(); } } impl<T: FnOnce()> Drop for Deferred<T> { fn drop(&mut self) { if let Some(task) = self.task.take() { task(); } } } fn d...
Read more
February 10, 2025

CAP theorem

During a network partition (P), the CAP theorem states that we must choose between Consistency (C) and Availability (A). The fundamental reason is that during a network partition: • Some nodes can't communicate with each other • Clients may write to different nodes • System must have a way to resolve this conflicts The key conflict is ...
Read more
February 10, 2025

Hashes in Python

I found out some interesting details about hashing in Python. An object is hashable if it has `__hash__()`, that has hash value that never changes. Immutable data, or even mutable data that is guaranteed to no change, has hash available. Hashable types: These are commonly hashable in Python, int, float, complex, str, bytes, bytearray, ...
Read more
June 11, 2021

Easy error handling in Rust

Creating new error types Let's wrap std library errors with our Errors use std::fmt; use std::fmt::Debug; use std::num::{ParseIntError, ParseFloatError}; #[derive(Debug)] enum MyErrors { Error1, Error2 } We also need to implement fmt::Display for our Errors. impl fmt::Display for MyErrors { fn fmt(&self, f: &mut fmt::Formatter) -> fmt:...
Read more
May 27, 2021

Worker Queues

Tried Beanstalkerd, for a job queue, realized the language support is not very good. But, I realized Redis has Lists. We can use them to push (from producer) and pop (worker/consumer) Producer pushes 127.0.0.1:6379> RPUSH list2 0 (integer) 1 127.0.0.1:6379> RPUSH list2 1 (integer) 2 127.0.0.1:6379> RPUSH list2 2 (integer) 3 127.0.0.1:6...
Read more
May 27, 2021

NVim 0.5

I think I can consider Vim a good development environment. Vimscript is substituted by Lua. There are so many benefits to using Lua as a scripting language to extend Vim. Most of the basic Vimscript config can be ported to Lua. NVim 0.5 also has very good support for Language Server protocol. These are the things I mostly need for a te...
Read more
April 3, 2021

Web apps - How to?

The list of libraries available for deploying web apps, the list does try to aim to be easiest way to deploy single page apps on web. Web libraries 1. Phoenix LiveView (Elixir) So many possibilities with real time data updates on page. Requires server. 2. Rust+Wasm Yew framework, or flask-like Rocket in Rust Write full front end using ...
Read more
March 5, 2021

Noona you need to get up

Noona should get out of bed soon. Her holidays won’t last forever.
Read more
March 5, 2021

Hello world

This is a test blogpost. I want to create a new website like this. Test whether code blocks are working. print(“hello”)
Read more