RSSAmplifier

Blog

Amjith Ramanujam

Recent content on Amjith Ramanujam

amjith.comRSS feed ↗219 posts

Latest posts

Mammoth Lakes Trip

We were in Mammoth Lakes for a week. Day 1: Canoeing and DnD Rented a Canoe and splashed around Lake Mary for about an hour. Sempi was in the front, Vian in the middle and I sat in the back. Our coordination was abysmal but we managed. Next a hike near Horseshoe Lake on an easy trail to the double falls view point. The kids were engrossed in their fantasy DnD world building. We got back to the…

LLM in Litecli - 2

Part 1 LiteCLI has an optional feature to use LLM powered SQL generation to get answers from your database. The default LLM used by LiteCLI is OpenAI’s gpt-4o-mini. This can be changed to a different model including a local LLM running on Ollama. Here are the steps to show how to switch your LLM model. Run \llm to enable the feature. sqlite> \llm This will offer to enable this feature by…

LLM in Litecli

** This feature is ONLY enabled when it is used for the first time. ** LiteCLI v1.14.2 now has an LLM feature to help you write SQL. Getting Started: Upgrade litecli to the latest version (at least v1.14.2 or higher). uv tool install litecli@latest Open a SQLite database with litecli. $ litecli your_database_file.db Run the special command \llm in the LiteCLI prompt. This will install the…

Auto-Completing Click Commands

Click is a python library for creating command line applications in Python. The llm tool created by Simon uses click and it has a lot of subcommands. eg: $ llm keys set openai Enter key: ... $ llm models default gpt-4o I am building a wrapper around this CLI tool that let’s me use it in an interactive REPL. I wanted autocompletion to help me remind the available subcommands and their…

Restart a Python CLI

A simple snippet to restart a Python CLI from within the CLI. import os import sys import click @click . command() def cli (): click . echo( 'CLI is running.' ) # Logic that determines when to restart if click . confirm( 'Do you want to restart the CLI?' ): click . echo( 'Restarting CLI...' ) executable = sys . executable args = sys . argv os . execv(executable, [executable] + args) else : click .…

Introducing LLMs to Litecli

LiteCLI is a command-line client for SQLite databases that has auto-completion and syntax highlighting. I’ve added the ability to use an LLM to create a SQL query. Disclaimer: This is an EXPERIMENTAL feature. Not yet released . Ask a question about your database in English and get a SQL query back to find out the answer. This is the SQLite db used by Chrome. Exploring my Chrome history to…

Goodbye Netflix

“People are exhausting. But you’re not people.” A direct quote from my teammate during a dinner at a conference. We became very good friends after that trip. Back in 2017 I joined Netflix and moved our family to San Jose. I joined the team that built Chaos Kong . We brought our failover time from ~45 mins to under 7 minutes. True to Netflix’s culture I received some of the…

Ghostty Terminal

I got beta access to Ghostty and set it up on my MacOS (Sonoma) laptop. The terminal is nice out of the box. It has tab support and splits. The default color theme is pleasing. I still needed to adjust the configuration to make some changes to match my taste. The configuration file is located in ~/.config/ghostty/config , there is no UI based preference dialog (planned for the future). This is my…

Gods and Plagues

Sempi is the resident expert on all things greek mythology in our household. He will often share “interesting” facts in the form of “Did you know… ?”. One such conversation ensues. Sempi: Did you know that Apollo actually shot a plague of arrows? But it is often misintepreted as he shot arrows of palgue. Vian : What do you mean? Sempi: He shot so many arrows in the…

Ok Comedian

Vian : I think I'm ok at comedy. Yoshi: Oh yeah! Vian : Muhuhahaha! Muhuhahaha! *Vian starts laughing maniacally* *Yoshi joins in and start laughing* *Vian stop abruptly while Yoshi is still laughing* Vian : See, I told you I'm ok at comedy.

Regular Pentagon

I’m reviewing math lessons with Vian before his test. We’re on a chapter about polygons. Me: What is a pentagon? Vian: It's a polygon with five sides. Me: Good! What is a regular pentagon? Vian: A regular pentagon? Me: Yeah. Vian: I think it is a pentagon that is not special? Me: What? Vian: It's a pentagon without anything special about it. Just regular. Me: *laughing* It's a pentagon…

Nighttime Routine

Vian: Will you be available later today to answer some questions? Me: Sure, I'll be around. What questions do you have? Vian: What was the best part of your day? Worst part of your day? things like that.... Me: Dude, asking each other about our day is not an interrogation.

Pedant

Background context - Sempi likes to be very precise. Sempi: I'm going to have some tea before I get in the shower. Me: Hurry up you have 5 mins to finish your tea. Sempi: It'll take me more than 5 mins to just make the tea. Me: It's already 8 o' clock. I don't think you have time. Sempi: Ok. (Checks his watch) Me: (realizes he is precise) Technically it is 3 mins to 8. It is only 7:57. Sempi: No,…

Honesty

I&rsquo;m on a walk with Vian. We&rsquo;re strategizing about this new Donkey Kong vs Mario game. Vian: How can we make sure we finish the levels before the timer runs out? Me: What if we go for different keys in parallel? Vian: Oh yeah! I'll go for the silver key and you can go for the gold key? <silver key is usually harder> Me: Why? You don't trust me to get the silver key? Vian: No. Usually…

Data Driven Decisions

OKR - Objectives and Key Results Plenty of companies have chosen to use OKRs as their planning tool. Each team publishes a set of OKRs at the beginning of a quarter to signal to the rest of the company what work they intend to do. This is written in the form of an Objective (Eg: Make Builds Faster). Then comes the Key Result which is usually expressed as a measurable metric (eg: Reduce build time…

Social engineered by my kids

It&rsquo;s a Sunday afternoon and the kids chose to do 1:1 with each other. They are watching some minecraft tutorial videos on Youtube. Suddenly I hear Sempi running towards me and asks for 5 more minutes. I say sure and get back to my own activity (reviewing PRs on personal projects). Then 5 minutes later he comes back and asks for 3 more minutes to finish the current video. I agreed since it…

My Room (essay by a 7yo)

Have you wondered what my room looks like? Do you want to see my room? It&rsquo;s fuzzy, warm, comfy and plain. My bed is comfy and fuzzy and warm. My walls are plain with one painting. Also it has mario streamers on a different wall than the painting. I hope you liked learning about my room, if not that&rsquo;s ok. And now you have learned what&rsquo;s in my room. By V&mdash;&mdash; Ra&mdash;-…

LLMs and Freewill

During the late 1900s (1997) I learned about this theoretical concept called artificial intelligence, in high school. I asked my cousin (a CS college grad) about it. He explained that AI is a research field that is trying emulate a human brain but with a computer program. I wondered if that would be a nuisance? For instance, while I&rsquo;m studying I get distracted and decide to start watching TV…

Postgresql and Underscore

TL;DR: Underscore is a matching character in LIKE queries to match a single character. I&rsquo;m using Postgresql for one of my projects to store some python package metadata. Canonical python packages must be all lowercase and should not use underscores ( _ ) but instead should use hyphens ( - ) as delimiters. It is just a recommendation and not enforced by PyPI or pip. I wanted to check how many…

sqlite-utils &#43; litecli

sqlite-utils is a CLI tool for manipulating SQLite databases. I&rsquo;ve used sqlite-utils and shot-scraper in the past to port my blog from PostHaven to this static site. Recently sqlite-utils added plugin support and Simon the creator of sqlite-utils wrote a few plugins to showcase the plugin system. One of them is a sqlite-utils-litecli plugin which launches an interactive shell with litecli .…

Python at Netflix

Zoran and I were guests on the Talk Python Podcast to discuss how Python is used at Netflix. The host of the podcast Michael Kennedy was well prepared with the background context and led the conversation in interesting ways. We got to cover a ton of different use cases at Netflix that use Python. I got to talk about some of my favorite OSS projects ( bpython , pdb++ , dbcli etc). We ran out of…

Finding the most frequent value in a SQLite column

I have a table with a list of trails that I&rsquo;ve biked. I wanted to find out which trail I&rsquo;ve biked the most. I used the following SQL query to find out: SELECT name, count (name) AS ct FROM trails GROUP BY name ORDER BY ct DESC LIMIT 5 This gave me the 5 trails I&rsquo;ve biked the most. Translated to SQLAlchemy. from sqlalchemy import func def most_common_trails (db: Session): return (…

Updating a SQLite row with a value from another row

I had a table with a bunch of users and one of the users is a demo user and I wanted to copy the login token from my row to the demo user. This is how I managed to do that. UPDATE users SET token = ( SELECT token FROM users u WHERE u.id = 1 ) WHERE id = 2 ; This will update the token column for the user with the id 2 with the value from the user with the id 1 .

Vector Search

Recently I learned about a new kind of search called Vector Search or Semantic Search . This is a search technique that tries to find documents that match the meaning of the user&rsquo;s search term instead of trying to match keywords like a Full Text Search (FTS). I wanted to try Semantic Search for my blog. I came across Alex Garcia&rsquo;s post about a new SQLite extension for Vector Search…

Search (FTS)

Now that my blog is statically generated I need a way to support searching. Fuse.js ships with the theme and does a pretty good job of matching words in the blog posts. I want something a little bit more powerful. I mentioned in my previous post that I am using SQLite to store the blog posts. SQLite has a full text search feature that I can use to implement search. Enabling Full Text Search (FTS)…

Triggering multiple api calls in HTMX

I am a big fan of htmx and use it in a lot of my projects. I recently had a use case where I needed to trigger multiple api calls in a single htmx request. I was able to do this by using the hx-trigger attribute. < html > < head > < script src = 'https://unpkg.com/htmx.org@1.9.2' integrity = 'sha384-L6OqL9pRWyyFU3+/bjdSri+iIphTN/bvYyM37tICVyOJkWZLpP2vGn6VUEXgzg6h' crossorigin = 'anonymous' ></…

Migrating out of PostHaven

My blog was hosted on PostHaven for about 12 years now. It&rsquo;s a pretty good platform and has served me well. But I wanted to move my blog to a MarkDown powered static site. Unfortunately, posthaven doesn&rsquo;t provide an export option, probably because it not in their financial interest. Oh well, I&rsquo;ll scrape my own blog and extract the posts. My first attempt was to use the requests…

Opportunities

I am setting the table for breakfast. I announce loudly &ldquo;Breakfast is ready&rdquo;. Vian sits down at the table and notices that I had left two forks next to his plate of cantaloupe slices. Vian: Who put two forks? Me: Oh, I didn&rsquo;t realize I left two forks. My mistake. Vian: No, it&rsquo;s ok. Then proceeds to use both his forks to pick up two slices of cantaloupes and starts shoving…

Opposite of a Crater

The kids are having Pizza. One of the pizza slices had a trapped air bubble and looked engorged. Yoshi: Looks like there is a crater in your pizza. (from her angle she could only see the gaping hole). Sempi: (from his side he can only see the bulge) No it is the opposite of a crater. It is a meteor. TIL the opposite of a crater is a meteor.

Egg Skin

We are at the breakfast table. Vian is having cereal and I am having hard boiled eggs for breakfast. I offered one of my eggs to Vian. Vian: I don&rsquo;t like the yolk. Me: I can take it out for you. Vian: Yeah, if you can take out the yolk, I will eat just the skin.

Kinder Graduation

Vian&rsquo;s last day of graduation was yesterday. It was a heartwarming ceremony where the teacher recognized each kid with a certificate for a certain quality and had the kids announce what they want to be when they grew up. Vian was recognized as a problem solver. He then stood up and announced, I want to be a dad when I grow up . Needless to say I was floored by this announcement. I was…

Conversations with a 6yo

Yoshi is having a serious conversation with the kids. Vian is jumping around being playful and generally not paying any attention to Yoshi. Yoshi: Vian did you hear what I just said. Vian: Yeah! Yoshi: Can you tell me what you heard? Vian: I don&rsquo;t know. Yoshi: But you said you were paying attention. Vian: I&rsquo;m just really good at forgetting.

Conversations about the largest number

We&rsquo;re at a restaurant waiting for our food. My 9yo is discussing large numbers. Sempi: Did you know that googol is 1 followed by 100 zeroes? Me: Yeah. Sempi: And googolplex means 1 raised to the power of googol. Me: Technically it is 10 to the power of googol because 1 to the power of anything is just 1. Sempi: Ok. (whatever). Me: Also Google is named after googol. Sempi: I know. Me:…

Hot Cocoa Part 2

Yoshi is making hot cocoa for everyone after our snow play day. Me: I think I&rsquo;m going to drink all the hot chocolate that Amma is making. Vian (5yo): If you drink my hot chocolate, I&rsquo;m going to punch you 5 million times in your face. Me: You can&rsquo;t even count that high, Vian. Vian: Ok then I&rsquo;m going to punch you one hundred times.

Measure of Age

Vian (5yo) is curious as ever. He asked me how old I am. Me: I am 40. Vian: You know 40 is not that old for an adult. Me: Really? How come? Vian: I can count to 40 really fast and it doesn&rsquo;t even take that long. He then proceeds to demonstrate how quickly he can count from 1 to 40.

Confidence of a 5yo

I don&rsquo;t know how to play Minecraft. Vian (5yo) decided he&rsquo;s going to educate me. We&rsquo;re now playing real-world Minecraft in the front yard without a computer. He&rsquo;s narrating various aspects of the game as he&rsquo;s walking around the front yard. A leather armor, iron ingot, wooden pickax, bedrock and so on. Then he delivers this pearl of wisdom. Vian: Here&rsquo;s a good…

Bejeezus

The kids like to scare me by trying to jump out from under the covers and yell &ldquo;BOO!&rdquo;. I like to pretend that I&rsquo;m scared of their tactics. The other day I decided to return the favor by suddenly entering their room and yelling &ldquo;BOO!&rdquo;. I managed to scare Vian and he started giggling in fear and shrunk back under his comforter. Me: Hey Vian, looks like I scared the…

Picture Day

Vian is back from school, wearing a button up shirt and slacks. Me: Vian, you look dapper today. Vian: Yeah. Today was picture day. Me: Oh yeah. Did you guys go out and take a picture? Vian: No. It was just someone else taking the picture. I didn&rsquo;t take the picture. Talking to my kids is the best way for me to realize how imprecise my communication is.

Conversation with an 8yo

Me: Whoa! It&rsquo;s very late, we should have started getting ready for bed 20 mins ago. Sempi: 20 minutes isn&rsquo;t that much. If you think about it, it is only 4 time 5 minutes. Sempi: And if you think about it, 5 minutes is just 5 times 1 minute. Sempi: And if you really think about it, 1 minute isn&rsquo;t that long. That&rsquo;s the spirit. I should remind him of this conversation when he…

Conversations with an 8yo

Sempi gets very creative when he&rsquo;s building Lego structures. So I asked him about it. Me: How did you get so good at building these lego creations, Sempi? Sempi: I don&rsquo;t know, I just like building things. Me: Would you say that I should just keep building things and I&rsquo;ll get better over time? Sempi: It is easy to create something for yourself. You know what you want and you can…

Michelangelo

Tonight we read Calvin and Hobbes for bedtime. After I read the comic strip above, I tried to explain a little about Michelangelo. Me: Remember, Michelangelo, we saw the statues he made when we went to Italy? Sempi: Yeah. Me: He&rsquo;s a great sculptor. Do you guys remember the David statue? Vian: I know who Michelangelo is, he&rsquo;s a TURTLE! o_O

Musings of an 8 year old

Vian was playing with his stuffed animals. Vian: Watch my deer. It can do a somersault backwards. Sempi: (thinks for a bit, turns to me)&hellip; if you call a flip a somersault, do you call a backward flip a wintersugar ? Me: What a terribly missed opportunity. They just call it a reverse somersault, those unimaginative linguists.

Bug not a Feature

We are having dinner. Sempi is eating enthusiastically and suddenly cried out, &ldquo;AAARGH!&rdquo;. Me: What happened? Sempi: I accidentally bit my tongue while chewing. Me: I&rsquo;m sorry Sempi, that must be quite painful. Vian who is listening to all this plays around with the food in his mouth and suddenly declares: Vian: You can actually bite your tongue anytime you want, not just on…

Not a Dinosaur

I&rsquo;m reading a bedtime story to the kids. There&rsquo;s a picture of a Pterosaur in one of the pages. Vian: That is not even a dinosaur. I am quite proud that he know that Pterosaurs are not Dinosaurs. Me: Oh, what are they? Vian: They&rsquo;re just grown-up chickens in the sky. Sempi: Argh! They&rsquo;re called Pterosaur, Vian. Ugh! Vian likes taunting his brother, so he repeats his flying…

Nose Beard

I like giving and receiving kisses from Vian (my 4yo son). Recently, Vian complained that my beard was prickly. Obviously, I&rsquo;m now clean shaven (no more goatee). On the nights I put him down for bedtime, he usually gets quite sleepy while I lay down with him. Occasionally he would run his hands on my cheeks and say &ldquo;Amma?&rdquo; (mom). That&rsquo;s gotta be the highest praise for…

Nevermind

Vian (4yo) and Yoshi are snuggled up in the office couch with a cozy blanket around them, playing a game on iPad. Vian turns to me and says, Vian: Appa, can you get me something to eat? Me: Come with me, let&rsquo;s find something for you. Vian: But I&rsquo;m too comfy. You get me something. Me: Ok, but you have to eat whatever I get. Vian: Nevvvermind&hellip;.

Groovin&#39;

Vian (4yo) runs into my home office and threatens to slice me. He strikes a pose with a hand on his hip, legs wide apart and a foam sword in one hand. I turn on my music which plays an upbeat song on the speakers. His tiny legs start moving to the melody and pretty soon he&rsquo;s shaking his hip and bobbing his head. The kid can&rsquo;t control himself when it comes to music. I&rsquo;ve taught…

Tricking a Couple of Kids

Both kids insisted that they want to get ready for bed last. I told Vian (4yo) in secret that we&rsquo;re going to trick Sempi (8yo). He should floss and brush but not do MiPaste (a Fluoride paste). Then after I get Sempi ready we can do MiPaste, Vian would be the last to get ready. Vian bought into the idea and he brushed first with a mischievous glee. The plan worked like a charm, Sempi was…

Computers and Memory

When Sempi and I go on walks, we occasionally discuss something we both find interesting. Today during our walk today, I told Sempi memory is a tricky thing. If we have to remember a sequence of numbers some of them are really easy but others are hard. For example, we can easily remember 1,2,3,4,5,6,7. We can also remember 7,6,5,4,3,2,1 but it is quite hard for us to remember a random sequence…

Orange?

Sempi declared that he found a word that rhymes with Orange, the color Orange. He thought they had different spelling, after I corrected him the following conversation ensued. Me: The color orange and the fruit orange have the same spelling. The meaning differs based on the context. For example, when you say my car is orange it means the car&rsquo;s color is orange, it doesn&rsquo;t mean the car…