Failed image loading

Reflections on two years on the industry.

I have been working as a software engineer for a little more than two years now. Having worked at two different places, I think the following summarize what I have learnt so far. I can’t say that I have folllowed these, but I have tried to keep them in mind lately, and arranged my thoughts to put these down. Caring just enough Right after graduating, I started working at a startup. It was fun, but there were times when it was just too much. I felt like I was always busy with something but not really doing things that mattered. The spotlight for the startup is someone else. Anything you do not is the spotlight is not appreciated. The tasks will always seem endless, and the light at the end of the tunnel is important, even if its a fake one. The trick to be able to working for someone not yourself is to care just enough. Not too much that you are frustrated at the situation, but not too little that you don’t yourself improve. Care too much and you burn out, feel just hatred for the job, the team, their shortcomings, their management, all the things. Care too little and you are not enjoying, you’re bored, you’re underperforming, and you risk getting fired, and no one likes that. Having grit Over the last two years, I have found that having grit is the one thing that actually gets some work done. There are countless things that are fun to do, that seem productive, that will teach you something new, something you like, but these are things that only you know. Only you know that you’ve read all those articles about eBPF, or Elixir, or Gleam or Terraform or anything else. And you surely learned something new in those articles. But the only thing you can do now is forget. You need to be doing something, you can’t just pretend to learn. You need proof for it to mean something. So, have grit, let go of the fun articles, that new language, that awesome technology, and build something. It is difficult, but it will seem awesome when you’re done later. Investing in tools It took me way too long to realize this. The tools you learn are yours to keep, forever(at least if you pick your tools carefully). So, master your tools. No one cares how much time you spent on doing a task, so might as well use the tools that make you faster, or make it easier. I have completely shifted to vim and tmux for my terminal needs, and I can’t imagine going back. Along with a host of other tools, docker, ffmpeg, or just git. Can’t imagine how much time I have saved by using simple tools. Your knowledge also keeps accumulating. That library you build today will save you a lot of time some day. I love how people taking part in gamejams create breathtaking games in just a few days. And their secret is that they have stashed their knowledge from regularly tinkering with so many ideas, and their prefabs, libraries that they built over the time they have been learning. So, when its time to build something, they have a solid system. Build systems, not just projects. Build libraries, not just scripts. Build tools, not just code. Having freedom of thought This one’s pretty simple, have time for reflections. Autopilot is not the way to go. You need to be able to try out things, meet new people or do whatever you find interesting. Plan out what you want to do. Don’t be so invested in someone else’s dream that you forget yours. Life is but an optimization problem, re-adjust your strategy from time to time.

September 17, 2025
Failed image loading

Cloudflare Tunnels: Expose your local server to the internet.

How can you quickly expose your local server to the internet? There’s ngrok which is as easy as ngrok http 8000 but it has a free tier and the domain changing every time is a hassle. So I use Cloudflare tunnels. It is free and you can use your own domain. Add you domain to Cloudflare and then install the cloudflared tool. Then create a tunnel using the following command: ...

June 17, 2025
Failed image loading

Why is my Golang server (not) crashing?

I was hit by one of these “you didn’t know this, now suffer” moments today. I was working on a websocket server and was gradually adding new functionality. Out of nowhere, the server started disconnecting the client. Without any error whatsoever. I even wasted some time thinking maybe the client was doing something wrong. Then with no luck with anything I tried, I tried to use the debugger. The debugger would execute the last line of a function and then the client would disconnect. This is the exact function ...

June 3, 2025
Failed image loading

Tmux Snippets (take your commands with you everywhere!)

Wouldn’t it be great if you could take your commands with you everywhere? Sure aliases are great but can you really put a price on the feeling of just getting the command you want when you are in a ssh session? So here it is. Use tmux snippets. Your terminal remembers your commands for you. Installation Use tmux plugin manager tpm to install the plugin. 1 set -g @plugin 'nyuyuyu/tmux-pet' Use prefix + I (Uppercase I) to install the plugin using TPM. ...

May 18, 2025
Failed image loading

Where are my bits getting lost?

Today I was trying to implement the Snowflake Id generator for Fly.io Gossip Glomers second challenge, Unique Id generation. Here’s what I came up with. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 package main import ( "encoding/json" "log" "strconv" "time" maelstrom "github.com/jepsen-io/maelstrom/demo/go" ) type Snowflake struct { sequenceNumber uint64 selfId int lastTs int64 } func nextId(s *Snowflake) uint64 { ts := time.Now().UnixMilli() // this is 41 bits if s.lastTs == ts { s.sequenceNumber++ } else { s.sequenceNumber = 0 } s.lastTs = ts var id uint64 = uint64(ts << 22) // (64 - 1 sign bit - 41 unix timestamp bits) log.Printf("shifted %d", id) id = id | ((uint64(s.selfId) & 0x3f) << 16) // machine id is 10 bits log.Printf("after self Id %d", id) id = id | ((s.sequenceNumber & 0xffff) ) return id } func main() { n := maelstrom.NewNode() sf := &Snowflake{} n.Handle("generate", func(msg maelstrom.Message) error { var body map[string]any if err := json.Unmarshal(msg.Body, &body); err != nil { return err } selfId, err := strconv.Atoi(msg.Dest[1:]) if err != nil { log.Fatal("Cannot parse destination as a number", msg.Dest) } sf.selfId = selfId body["type"] = "generate_ok" body["id"] = nextId(sf) return n.Reply(msg, body) }) if err := n.Run(); err != nil { log.Fatal(err) } } It wasn’t too bad for how simple its supposed to be. My solution wasn’t getting accepted by maelstrom because there were duplicate Ids generated by my program. After looking at my code for very long and not finding any idea what went wrong, I asked ChatGPT, it suggested the sequenceNumber bits were too few and must probably be overflowing. After looking at the maelstrom logs I found the lines which had duplicate Ids. ...

April 2, 2025
Failed image loading

Python: Solving slow eval

Welcome to another one of my interesting findings, where I explore some stuff for fun and profit just fun A while back I was solving AOC and for a problem (day 13), I had this sort of clever idea of using eval to skip writing a if else ladder. The input file had the following structure Starting items: 91, 65 Operation: new = old * 13 Test: divisible by 5 If true: throw to monkey 7 If false: throw to monkey 4 I had to parse the file to get all values, but when parsing the second line I thought why not use the python interpretor itself. And so, I created a variable called old and whenever it needed updating I would use the following line ...

January 10, 2023
Failed image loading

Why does my drive mount as read only?

Today I tried to write an fstab entry so that my drive would automount on boot. It went as smoothly as I had hoped (at first). So, I ran sudo blkid to find the UUID of the drive I wanted to mount and added the entry UUID=288C1E6C8C1E3532 /hdrive auto defaults 0 0 following the steps in this wonderful article. (Some options are different after I realized what I wanted.) Article Then I ran sudo mount -a to check if the mounts were working properly. But here the problem began. The drive was mounted as readonly. There is no mention of readonly mount in the options. In fact I learnt that defaults option is shorthand for rw (read write) and bunch of other options. Then I tried various mount options and got sick of rebooting. I tried directly mounting as ntfs instead of auto. But it didn’t work. After lot of struggle I figured out the problem. It was because of my Windows Installation! I have dual boot setup. And turns out windows stores some files for faster booting (fast boot) in the harddisk thus linux cannot mount the drive cleanly and can only mount it as a read only drive. So to fix this I had to boot to windows and change the fast boot setting. Here’s how, ...

January 17, 2022
Failed image loading

Google Sheets as Database?

I recently learned that Google Sheets can be used as a database (although with caveats I hear). And I love it. It is so much easier to see what is in the spreadsheet than on a sqlite file. Plus, google sheets works everywhere! So, to get started, the official way to do this is from the google developers website. https://developers.google.com/sheets/api/guides/concepts It is not so easy to understand for a beginner(which I am). So, upon further looking around I came across this wonderful python library that makes things so much easier. It’s gspread. ...

December 14, 2021
Failed image loading

String Bug

Today the coding calendar Advent of Code started. You should try it too, Advent of Code. I tried to solve the first challenge. It was pretty straight forward. Except, I was stumped by a simple problem. Here is my first attempt, 1 2 3 4 5 6 7 8 9 10 11 12 def part1(lines): prev = lines[0] more = 0 for i in range(len(lines) - 1): if lines[i+1] > prev: more += 1 prev = lines[i+1] print(more) if __name__ =='__main__': with open('./input/day1.txt', 'r') as f: lines = [a.strip() for a in f.readlines()] part1(lines) The thing is it gives correct result for the test data. So, I assumed it would work for the input data. But, the program always gave me 1 less than the actual answer. I couldn’t figure out why. Notice, I use string comparison in the if condition on line 5. I knew using string for comparison of numbers was a bad idea but, the following IDLE experiments convinced me otherwise. ...

December 1, 2021

First

Welcome! This is the first post of my blog! What is this about? In an attempt to make myself “productive”, I try to write about anything I find interesting. Tell me something interesting at [email protected]

November 21, 2021