RSSAmplifier

Blog

Dhruva Sagar

Recent content on Dhruva Sagar

dhruvasagar.devRSS feed ↗58 posts

Latest posts

The Knowledge Operating System

A graph of five hundred interlinked notes taught me that capture and linking are not enough — knowledge needs structure to be documented, referenced, and discovered. This is the layer I added on top: atomic concept notes, one index node per book, graded evidence, and reviews that turn knowledge into behaviour.

How the Water Holds

The water holds your body. It holds your attention. It holds what you carry. Notes on healing, disruption, and what a 4k swim through salt and tide taught me about being held.

The Poverty of Language and the Search for Emotional Precision

Language compresses rich subjective experiences into symbols that others must reconstruct, making misunderstanding inevitable. Storytelling addresses this limitation by providing context, causality, and emotional structure, creating simulated experiences that allow people to understand one another more deeply. While perfect transmission of experience may be impossible, stories may be one of…

The Fear Tax

Fear in the workplace is not a motivator. It is a tax. Leaders who let it persist — or quietly benefit from it — are paying that tax with their team’s initiative, creativity, and willingness to care. Here is what honest leadership looks like when the future is genuinely uncertain.

Keep the Friction

AI is best at removing exactly the friction where craft, focus, and satisfaction used to live. Refusing it is a pose; there is no exit. The real move is to choose, deliberately, where you keep doing the hard part by hand; because doing it is the point.

What I Got Wrong About Discipline, And You Might Too

For years, I thought discipline was simply working hard and striving to improve. Only recently did I realize that true discipline is the resilience to show up and do the work even when you least want to. Here’s what I got wrong, and what you might too.

Introducing ruby-upgrade-toolkit

A Claude Code plugin for Ruby and Rails upgrades. Phased commits, real estimates, project-specific rules. Audit, plan, fix, verify, commit.

Slow Down to Speed Up

Why getting faster has always required slowing down first — and why the cycle never really ends. Lessons from the cube, the pool, and the codebase, learned and re-learned.

The Matrix Has No Exit

The Matrix got the diagnosis right and the cure wrong — there is no Morpheus, no red pill, no city beneath the city, only the simulation we already inhabit and the seeing of it.

Embrace the Wobble

Watching my daughter grip her bike’s handlebars for the first time, I
saw the familiar flicker of fear in her eyes, the apprehension of the
unknown, the hesitation to stumble, the dread of failure. It reminded
me of a feeling I know too well, one that lingers in moments of
uncertainty throughout our lives. 
 
 “What if I fall?” she asked. 
 I met her gaze and…

Building a Scalable Ingestion Pipeline With Rust

How to build a scalable ingestion pipeline with Rust

Positive Effects of Exercise on Mental Health

Exercise is also a form of meditation, has tremendous positive impact on mental health

Neovim as a Java IDE

Neovim has come a long way today from it’s original goal of being able to
support asynchronous jobs. Today it comes packed with a ton of useful and high
performance libraries and plugins. To add to that it also has a highly
enthusiastic and vibrant community of lua developers who are working
tirelessly to make neovim better. 
 Today we’ll look at how one can easily…

How to Speak

Collection of my notes from the lecture titled ‘How to Speak’ by Patrick Winston

Generic Callbacks in Rust

In a recent project, we developed an ingestion pipeline in Rust. We wanted to
execute asynchronous tasks in response to messages received from SQS, as
a subscriber . Our goal was to leverage Rust generics to allow the
subscriber to take ownership of the payload schema and the pipeline
implementation details. This approach enables the separation of the SQS
subscription logic…

DIY remote controlled pan & tilt CCTV using Raspberry Pi

RPi CCTV in Action : 




 
 
 

 A simple web interface to control the RPi CCTV : 




 
 
 

 What you need to build this (hardware) : 
 
 Raspberry Pi (1) 
 
 
 (1) Preferably Raspberry Pi-3, for on-board wireless, or
Raspberry Pi Zero W, although you can achieve similar result without…

SSH Config Trick


 Update2 : As I have been informed now, there has recently been support added
for including external files in the ssh config. Refer
 https://man.openbsd.org/ssh_config#Include 
for details. 
 
 
 Update : Modified the script for more flexibility to allow easy modifications 
 
 I use SSH nearly every day to securely connect to remote servers. For
simplifying…

Text Editor Choice & Peer Pressure

I am a VIM user and have been for quite a long
time (1) 
 
 
 (1) ~7 years
 
. I am both a vim plugin author and
also like to believe I have helped a lot of people switch / grok the core
philosophy that I believe distinguishes it from all other editors and gives it
an edge (IMO). 
 However, in this article I am not here to convince you to choose VIM as…

Template with Context using ERB

Recently, I was required to build a template rendering component that should
render within a dynamic context, i.e. it would have methods / variables
defined within a predefined context available during rendering, apart from
what was provided directly. 
 For simplicity we chose ERB ,
since we can place them within locale files for internationalisation and
designers could…

Slack old school style

Slack has gained a lot of popularity in recent times as
a tool for inter-team communication and for the right reasons. It offers a lot
of features such as 3rd party software integrations, rich content
communication, collaboration, bots etc. which when put together help create
a rich collaborative user experience for teams to work together, especially
when they are not…

WebRTC Broadcast

WebRTC is fun! I recently gave a quick session on WebRTC at Bangalore Ruby
User Group (BRUG). Following are the slides of my presentation. 
 
 
 
 
 
 WebRTC
 
 from 
 
 Dhruva Sagar
 
 
 

 For demo I had recently created a demo application in elixir using the phoenix
framework because it makes dealing with websockets really…

Pristine – ZSH Theme

A while back I posted about Amuse my prompt theme for ZSH targeting
 oh-my-zsh . Since this was a much appreciated theme, I would like to share
another theme, Pristine, that I have created. 
 However, I recently switched to using
 Prezto . This is because it felt
like a more minimalistic configuration framework for ZSH. I also wanted to get
faster load times. I must say my…

Google open sources it’s machine learning system

I am a huge proponent of open source technologies and having worked
predominantly in various web technologies in the course of my career, I mostly
work exclusively with open source stacks. 
 In the recent past I have been very keen to try and wrap my head around
Artificial Intelligence and more specifically Machine Learning, although I am
still barely even scratching the…

Grow your brain!

Learning is key in brain development. Of course what aspects and how much of
brain function improve as a result depends on the mode / type / content
& method of learning. But I am not here to talk about that. Now, this
knowledge isn’t new information, we all know this already, and have seen
it in good effect in children and hence we all know and understand the
importance…

Find huge files in linux

Switching to SSD’s for better performance and compromising on disk space can
be a tough decision to make. Though nowadays with the prices of SSD’s going
down, it is something that a lot of people are consciously doing. 
 However 
 
 
having spoilt by past experiences of having ample disk
space
 
 when you switch from a 500GB (or 1TB) hard disk to…

Google Code Jam 2014 Qualifiers

Google Code Jam has always been a competition I have cherished, simply because
the problems they post are brilliant and the closest to reality as compared to
problems of other competitions. They’re always fun to read, disect & solve,
more often than not, the solutions are reasonably
trivial (1) 
 
 
 (1) Especially for the qualifiers
 
 yet
extremely…

VIM Custom TabLine

Hi guys, 
 VIM has an option tabline that one can use to configure how the tab line
would look like. Back when I used to use gvim, I could very easily manipulate
how the text on the tab looked like by setting the guitablabel setting,
however tabline is not all that easy to configure. 
 Here is what I use now : 
 function ! MyTabLine () 
 let s = '' 
 for i in range…

Creating Custom Scratch Buffers in VIM

The other day I wanted to open a scratch buffer to write some temporary code
and the pass it on to a repl to test it out, the idea was that I could modify
it as needed and resend it back to the repl and see the changes, helps to
debug easily. 
 So I just wrote out this simple code here that allows me to launch a scratch
buffer in different ways, but the difference is I can set…

VIM – Filter Quickfix List

If you are used to using the quickfix list in VIM there are times when you
want to filter certain things out of the quickfix list to narrow it down to
relevant results that you need. Rather than firing the quickfix command all
over again with a refined expression, it is easier & often faster to simply
remove items from the list. I wrote this simple vimscript to do just that.

VIM – Toggle Ruby Hash Syntax

Ruby 1.9 introduced a new json style ruby hash syntax. Although we can use
this to define static hash objects and puts a limitation on the key we can
use, it’s a fairly neat syntax nevertheless. However I work on several
projects, both new and old and hence the new syntax is not always readily
available. 
 # Old style hash 
 hash = { :a => 'test' } 
 
 # New…

VIM for Multiple Projects in separate Tmux windows

My development environment setup consists of several tools, however the 2 most
used and essential tools that have a great impact on my workflow are tmux 
& vim . Since I often work on several projects, I find it best to work on
different vim sessions in separate tmux windows. 
 However tmux by default only shows the name of the currently running process
in the title and that…

ActiveRecord like where for array of hashes in ruby


 Edit : Updated the code as per the suggestions made by Masklinn. 
 
 Recently I was working on
 Issue#1 of my
 Soulmate Rails gem, which is
a very simple and obvious optimization that I should have thought of myself.
Thanks to lephyrius though for pointing it
out. In my search method I was looping through the search results and calling
find on each to get it…

VIM Markify

Recently I picked up some minor configs for ruby from Time
Pope’s 
 vimrc . Here’s the
code : 
 autocmd FileType ruby 
 \ if expand ( '%' ) =~ # '_test\.rb$' | 
 \ compiler rubyunit | setl makeprg = testrb \ \ '%:p\' | 
 \ elseif expand ( '%' ) =~ # '_spec\.rb$' | 
 \ compiler rspec | setl makeprg = rspec \ \ '%:p\' | 
 \ else | 
 \ compiler ruby…

VIM Better FoldText


 Update 3 : Improved the code for extraction of fillchar from fillchars 
option and taking foldcolumn into account. 
 
 
 Update 2 : Fixed the regex for removing the fold marker from the
displayed text by splitting the '{{{' in the regex to
 '{{'. '{' so that it is not treated as a fold marker
by vim. Thanks to Amadan on reddit
 Reddit
Tip 
 
 
…

VIM Table Mode


 UPDATE 2: Released v 2.0 of the plugin. Check github for details. 
 
 
 UPDATE : I have added more features to the original plugin, showcasing some
core features in a new demo (Part 2). 
 
 Recently a friend of mine showed off emacs table mode to me and to be honest,
I felt a bit jealous :). Hence I began to search for existing vim plugins that
might offer a…

Amuse – ZSH Theme

Amuse is a simplistic theme I built for the popular shell ZSH that I use. 
 Features : 
 
 Shows git prompt with additional support for dirty (! in red) and untracked
(? in green) git flags. 
 Shows the system time with a neat time unicode character. Although I am
sure most wouldn’t find having time on the prompt useful, I find it
very useful since it helps me get…

Vim Railscasts Colorscheme

VIM in my muscle memory is one of my popular posts, the day I published
it, I attracted over 3,200 unique views in a single day, mostly from Hacker
News and Reddit
Programming . Although it is an extremely
densely packed post with lots of information, I hope it has helped some to
appreciate VIM like I do. 
 In my several years of VIM usage, I have tried several…

Soulmate Rails


 UPDATE : I released the first stable version 0.2.1, it should be usable as
is without any issues. 
 
 One of the most common things to do in any standard rails web applications is
auto-completion. One interesting solution for this is by using redis’ sorted
sets (1) 
 
 
 (1) Which are blazing fast
 
, storing key value
pairs for partial matches.…

Tmux Powerline Special Characters Issue

Tmux is a terminal multiplexer like
 Screen on steroids. It is faster,
slicker and much more easily extendable than screen. For why you might want to
try tmux over screen checkout these articles : 
 
 Why you should try Tmux instead of Screen 
 Screen Vs Tmux 
 
 Tmux Powerline is an extension to tmux’s statusline which makes it look
incredibly cool. Look…

Ubuntu on Macbook Pro

As I have mentioned before ([Magician Chrome makes RAM disappear][1]), I had
been facing several issues with Mac OSX. I use vim extensively, and so I had
installed MacVim (1) 
 
 
 (1) after great
difficulty
 
 on my Macbook Pro, but recently while trying out
a new plugin I found there was something amiss between MacVim & Python on my
system and as a result…

Magician Chrome makes RAM disappear

Recently I have been experiencing a very weird issue on my Macbook Pro, I have
Lion v10.7.4, with a decent configuration : 2.8 GHz Intel Core i7 processor,
8GB Ram with a 750GB sata hard disk. But over a reasonably prolonged period of
usage, of around 4-6 hours, I notice from time to time that Mac OSX runs
completely out of RAM! The Activity Monitor reports mere MBs of Free…

VIM in my muscle memory

I have been an ardent VIM user for almost 4 years now, and it’s been
a while since I have been wanting to write this Blog. My motivation is not to
showoff or to start any flame war against any other popular text editors that
may or may not be better ;), but to simply showcase the things I like and
have come to appreciate in VIM, and show why you should seriously consider…

Artificially Intelligent Spyware

There has been tremendous advancement in the domain of Artificial Intelligence
(AI) and Machine Learning (ML) in the recent years. Although people often like
to take a shot at the state of AI on the grounds of the fact that several of
the early claims on AI that it will soon become almost as real as humans
haven’t really materialized, there still has been an incredible…

Getting started with Ruby – TOC

Hi, 
 I have written a series of articles (in several parts) in an attempt to guide
beginners to get comfortable with Ruby. This article is my attempt to build
a TOC (Table of Contents) for it to act as an index for people to get a brief
idea regarding what each article is about and help them get to the sections
they are interested in. 
 
 Getting started with Ruby -…

MongoMapper Plugin – Versionable

There was a requirement at one of our projects here at Artha42 Innovations
Private Limited that our Mongo Mapper documents have inherent versioning
so as to be able to track the changes being made and also if required revert
the changes to a previous state. Since we’re using MongoMapper, I set out to
create a simple plugin for the same to add the required functionality. 
…

Calculating Hashes

Showcasing how to calculate hashes in Java, C# and Ruby! 
 Java : 
 public String getHash ( String message , String algorithm ) { 
 try { 
 byte [] buffer = message . getBytes (); 
 MessageDigest md = MessageDigest . getInstance ( algorithm ); 
 md . update ( buffer ); 
 byte [] digest = md . digest (); 
 String hexValue = null ; 
 for ( int i = 0 ; i & lt ;…

Getting started with Ruby – Part 6

After having covered most of the basics of Ruby, lets get started on an actual
problem, just like I had promised in my previous article – Getting started
with Ruby – Part 5 
 I am taking a relatively simple problem that came in Google
Codejam 2009 qualification round. Here is
the direct link to the problem : Alien
Language 
 
 After years of study, scientists at…

Getting started with Ruby – Part 5

Hi in my previous article Getting started with Ruby – Part 4 I covered
Hashes & blocks. 
 Today I will take you through the various forms of loops in Ruby. 
 While 
 Executes code as long as the given condition is true. We can separate the
code from the condition using either the keyword do , a newline or
a semi-colon (;) 
 i = 0 
 while i > 5 do 
 puts…

Getting started with Ruby – Part 4 – Hashes & Blocks

In my previous article Getting started with Ruby – Part 3 I started with
Collections and covered basics of Ranges & Arrays. Like I mentioned towards
the end of the article (in case you couldn’t manage to reach the end) I will
start with one of the most commonly used Collection objects in Ruby, namely
Hashes. 
 Hashes are essentially data structures to store key – value pairs,…

Getting started with Ruby – Part 3 – Collections, Ranges & Arrays

In my previous article Getting started with Ruby – Part 2 I introduced
you all to Ruby & its philosophy and I started out with data type classes in
Ruby. I was able to give you an overview about Strings & Numbers in ruby.
Today I will start with Collections . 
 The Range 
 As the name suggests, ranges hold a sequential collection of numbers. Defining
a range in Ruby is…