1.5 billion! - That’s the approximate amount of tokens I spent on Claude Code, in January! And the number is conservative, for it excludes usage across 4 other machines in the cloud. Not included here is a fair bit of 2x Cursor subscriptions and Codex subscriptions. I recently added Gemini to the repertoire for evals. GitHub Copilot was my first ever sub. They’ve clearly lost the plot, so I…
Shock & Awe; Fear & Thrill; Existential crisis & Unbridled optimism - all together and all at once were the emotions that have been rushing through me for the past few years. Early on, it dawned on me that anyone in software who would refuse to get on with the program would be relegated to the past. There are three categories of developers: those who are passionate about building something (as an…
BTreeMap in rust’s equivalent of C++’s std::map , the former representing a self balancing tree data structure while the latter uses self-balancing binary search tree implementation (in the form of red-black tree). 

 Ordering Limitation 

 BTreeMap only supports ascending order by default and does not provide a built-in descending order, unlike C++. 

…
It started really exciting. Writing code that you can see, touch, and interact with on a device is magical. You are a creator, and you believe you are put on this earth to build awesome things. 

 The prototyping phase is done, but now is the time to publish it, and you step into hell. Developer certificates, entitlements, device registrations, the pain is endless. Yes, I am looking at iOS…
One look at Oddmu and I left inspired. The single text box for writing prose just seemed so irresistible, however the feature set, left a void, one that could only be filled by writing my own, for my own perceived notion of control and flexibility. 

 Enter Oddity. 

 Markdown files 

 It retains the idea of using markdown files that has appealed to me for a while.…
Every few years, I migrate the blog to a new engine or software, almost without fail. That time has arrived aright on cue, to rip out the last incarnation in the form of a hugo static site. 

 If I think about this in the right order, the very first iteration was in the form of a flat file cms (which formed the basis of nanocms), and then I moved to wordpress where it stayed there for…
While writing a new blog/writing/notes engine for myself (I am calling it Oddity , inspired by Oddµ), I wanted the ability to show git style diffs in my text, to primarly track changes I am making. The secondary goal was also to be able to debug content manipulation that the engine itself performs. 

 The diffmatchpatch library while excellent, proved to be a little unintuitive 

…
Postgres by default comes with utilities for running backups and restores. Postgres can dump to either a plain sql file or to its own internal format. The advantage of using the internal format is that it allows you to selectively restore data and schema. 

 pg_dump 

 It can dump the database in either sql file format or in postgres’s internal format. 

 Using this…
The following piece of code while it looks innocent actually does not compile 

 return int64(0.5 * float64((1<<n)-1))
 

 It produces the following error 

 exp.go:22:28: invalid operation: 1 << n (shift of type float64)
 

 What is happening here? 

 This is because when you do float64(1<<n) the first instinct of golang’s compiler is to…
The following commands allow you to query the size on disk occupied by tables, dbs and other relations. 

 Table size 

 SELECT pg_size_pretty( pg_total_relation_size('table_name') );
 

 db size 

 SELECT pg_size_pretty( pg_database_size('dbname') );
 

When submitting an ajax from, form.serialize() does not include the clicked button. We need to manually append this from the originalEvent attribute 

 $("form").on("submit", function(event)) {
 var data = $(this).serialize();
 if(event.originalEvent.submitter) {
 data = s['name'] + "=" + s['value'] + "&" + data
 }
 // continue
}
 

Code snippet to perform basic auth using go. Every incoming request is required to pass the the username/password combination in the headers and you are expected to validate and return a www-authenticate header response in case of auth failure. 

 hFunc := func(w http.ResponseWriter, r *http.Request) {
 user, pass, ok := r.BasicAuth()
 if !ok {
 fmt.Println("Error parsing basic…
Once in a while, I get around running network scans to check what devices and ports are open on my network. The proliferation of IoT devices in my home, combined with lack of VLAN capabilities of my router, has upped my uneasiness in the recent times. 

 There are two modes of scans I often run 

 MAC Address scans 

 All devices on my router have to be manually mac address…


 As with 2016 , 2017 & 2018 , I spent time lot of time reading in 2019. I managed read a total of 28 books, of which a fair amount ended up being science fiction. 

 

 

 
 

 Non-fiction 

 Its good to get the nonfiction list out of the way as its pretty short. I enjoyed every single one of them. They were light, informative and useful.…
This is a follow up to Part 2 of my Mark2 design and build of Plant watering system. 

 Learning 

 
 The 3.7v LiPo was unable to deliver the required current of about 350 mA for running 2 motors simultaneously. This lead to the batteries dying out prematurely while being perfectly capable of squeezing out juice for just one motor. 
 Different plants have different water…