
Senior Developer @ IIT Madras
Land of Coconuts π₯₯
Joined September 2017
- Tweets1.2K
- Following645
- Followers656
- Likes585
"So... what happened here? Why did we do that? And why is it suddenly working? I wasn't paying attention, apparently." π
2
208
Amazon just sent me a refund of Rs. 366.6599999999999997 π
Β Β
Not Rs. 366.65. Not Rs. 366.66. Precisely 366.6599999999999997.
This is the classic floating-point precision problem. Computers can't represent most decimal numbers exactly in binary, so 0.1 + 0.2 doesn't equal 0.3, it equals 0.30000000000000004.
Β
When you use float for money, you're asking for this exact mess.
Β Β
This is why we have exact numeric types at every layer of the stack:
Database (SQLAlchemy):
from sqlalchemy import Numeric
Numeric in SQLAlchemy maps to SQL's DECIMAL type, base-10 storage, no binary rounding. Decimal in Python does the same at the application layer.
Amazon's backend probably did the math in float, got 366.6599999999999997, and forgot to round before sending it to WhatsApp.
Β Β
Two lines of code. That's the difference between a professional refund notification and... whatever this is. πΈ
Β Β
Use Numeric in your schema. Use Decimal in your code. Never use float for money.
62
Visualize step-by-step
If youβre learning algorithms and feel dumb sometimes, this helps more than you think ! @neetcode1 @
97
If youβre struggling to start Data Structures & Algorithms, read this.
Let me show you a simple stat that changed how I look at it.
First, what is NeetCode?
NeetCode is a popular learning platform that curates the most important DSA problems (mostly from LeetCode) and organizes them into a clear roadmap, so youβre not randomly solving questions.
Now the interesting part π
According to data from neetcode.io:
- Solving just 11 questions already puts you in the top ~26% of users
- Solving 25+ questions puts you in the top ~8.5% of users
Read that again.
You donβt need 300 problems.
You donβt need to be a βDSA godβ.
You just need to start.
Most people never even cross 10 problems. Consistency alone separates you.
If youβve been delaying your DSA journey because it feels overwhelming - this is your sign.
Open NeetCode. Pick one problem. Start today.
P.S. I am in the top 15.3% by the way π
93
Fixed a critical JWT token refresh race condition that was logging users out unexpectedly
Ever had users complain about being randomly logged out during active sessions? We found the culprit: a race condition in our token refresh logic.
The Problem:
When multiple API calls failed simultaneously (like on page load with 5+ requests), each one tried to refresh the JWT token independently. This caused:
- Multiple refresh requests hitting the server at once
- Token invalidation when the backend consumed the refresh token
- Users getting logged out unexpectedly
- Poor UX during active sessions
Implemented a mutex pattern to ensure only one token refresh happens at a time. All concurrent requests now wait for the same refresh operation instead of creating duplicate requests.
The Impact:
- Zero unexpected logouts
- Reduced API calls (1 refresh instead of N)
- Better performance and user experience
- Cleaner, more predictable code
1
80
Day 1 of the job-switch grind after 9-hour work day
Todayβs grind:
β’ 6 LeetCode problems β 6 Accepted β
β’Day 10 of #30DaysOfRag - Enough with theory and decided to build something on my own.
- DocQuery AI β Chroma vector DB with my own PDFs created β
1
2
69
Loved it π
Stop Scrolling and go check your GitHub Wrap for the year 2025!
We (@itsnotryan) just shipped trygitwrap . com
Share your GitHub wrap below!
100
Replying to @Sumits_X
I work in a start up.
Screen monitoring during work hours is normal for us.
1
485















