Pratyush Mittal
Hobby coder and a stock investor.
Co-founder Screener.in
"Every line of code, every comment, every line-break should have a purpose."

We usually use Github's review feature for code reviews. It is hard, however, to jump between files when the changes are large. An ideal way would be to manually mark each and every line as checked during the review.

I use a combination of git reset and git add -p to do just that. Sharing the recipe below 🤫.

Algorithm
- Switch to the branch we want to review.
- Merge main into it.
- Create a new review-branch from that branch.
- Git reset to unstage differences from main.
- Use patch mode to break changes into small pieces.
- Add and stage reviewed lines. This is where we manually mark each and every line we have reviewed. We can also make changes as we review.
- Go back to the source branch we started the review with.
- Checkout changes from our review-branch to this branch.
- Push changes from our review.

Actual commands
The whole process looks something like this.
# create a new review branch
git switch branch-to-review
git merge main
git checkout -b review-branch-to-review

# unstage changes from main
git reset main

# review each and every line using patch mode
git add . -p

# make edits during review
# work as we normally do
git commit -m "<message about changes>"

# go back to the branch-to-review
git checkout branch-to-review

# stage changes from our review branch
# the dot (.) tells to checkout the changes in current directory
# --no-overlay tells to include deleted files
git checkout branch-to-review . --no-overlay
git commit -m "<review message>"

Automating the above using Justfile
These are still a lot of commands. It is easy to mess them up. Wouldn't it be great if we can do something like:
just review

# work on code as we normally do
# and then
just finish-review
Well, this is what this script does. I place it in ~/justfile. It uses Just for adding commands. Now we can use these commands in any project.
We have been of multitasking between tax returns, feature prototypes and code reviews for the last two weeks.

We discovered Section 54F this time. This section exempts capital gains (with no upper limit) if the proceeds are invested in buying or constructing a house. Very interesting. This is something that my Dad does. He creates a physical asset in every bull run.

Last year we discovered section 115BAA. It allows companies to opt for lower tax rates of 22%. Awesome!

Bulk and Block Deals on Screener

We added a lot of things in bulk and block deals over the last 2 weeks:
- Shareholder pages display the bulk and block deals along with major holdings.
- Company pages show bulk and block deals too now.
- A "recent deals" indicator.
- Reverse search for people from company pages.
- A page to browse through latest deals (wip): https://www.screener.in/trades/

Stock Alerts (coming soon)

Kavi and I have been working on a new stock alerts feature. It is almost done now. This is what it will look like:
Preview of Stock Alerts feature on Screener.in

Tools

Just is a command runner. It allows us to create small recipes. We can use these recipes system-wide or for specific projects. I automated our code-review workflow using Just this week.
I love reading how software companies work.

We are a very small tech team at Screener. Just 4-5 of us. Yet it becomes chaotic sometimes.

At the same time, there are companies which have 10s, 100s and 1000s of developers. They have fabulous products and keep rolling out new features. I admire them and try to learn a few tricks from them. About how they distribute work, how they keep the codebase sane and how they drive innovation.

These are few of the learnings and mental models from various books.

1. The E-Myth Revisited
This book introduced me to the concept of creating franchisees. It prescribes methods for creating companies like McDonalds, Tanishq, HDFC, Hiltons etc. The fundamental concept is to "make ordinary people do extraordinary things." It does so by creating systems and having manuals for everything.

It recommends having a "functional prototype" where you do all the experiments. Then you observe and document all the processes, create an organisation chart and properly assign the responsibilities. This functional prototype is then distributed and scaled as franchisees.

2. Netflix
The Netflix culture is totally opposite of The E-Myth. They believe that system driven companies fail in long run because they are unable to adapt to changes. They rather believe in hiring extraordinary people who can "use good judgement." They don't have any spending controls and very few signing controls.

This is in the lines of hiring the best, giving them independence and paying the highest.

3. Accidental Empires
This is one of my favourite books. Though it is not a management book, it does have a few chapters around structures.

It recommends organising companies like Police, Army and Commandoes. A company needs a large team of police who manage existing products (existing cities). An army of strategists who plan new territories. And a team of commandoes who actually go and conquer those territories.

4. Creativity Inc
Ed Catmull has worked all his way from being an animator to being the head of Pixar. He closely studied various working styles and shared them in this wonderful book.

Two of his major takeaways were:
1. Hiring people better than yourself
2. Putting quality first

Ed shares about multiple instances where their stories were not taking proper shape. Hiring the best story tellers, the best animators and the sharpest minds helped them achieve the best. As a manager, this required him putting his own insecurities away, and hire people more accompanied than himself.

Another insight that Ed shares is about the focus on quality. The Japanese manufacturing system allowed anyone in the assembly line to stop the conveyor belt. They encouraged (and expected) workers to halt production if they found any defect.
This is an important part of Pixar culture. Though they have a hierarchy, everyone in the company is encouraged to take responsibility without requiring a permission.

5. The CEO Factory
Saw this tweet about Unilever's organisation style.

They classify their team into Mavericks, Company Men and Rogues. The Mavericks are the creators. They are introvert and like to work alone. The Company Men are team players. The Rogues are high on energy but put their short-term self-interests first.

Unilever tries to encourage Mavericks and the Company Men. While Company Men climb to the very top, the Mavericks become the legends in the company's folklore. Rogues rarely make it past middle management.

This is a good way to think about the performances of individual employees.

6. Mythical Man Month
I found this book most relatable. It focuses on product unity.

The book gives 2 analogies for organising and delegating work:
1. The Surgeon Way
2. The Architect Way

The surgeons way works great for small teams. We have a surgeon working on the core problem. There is a co-pilot, with whom the surgeon discusses everything. However, the final decisions rest with the surgeon. The rest of the team helps surgeon do their best work.

The architect way works great for larger teams where the work is divided. It is very similar to how an architect works on a building. They provide the blueprints and idealise the whole project. They define the interfaces that the user will ultimately use. They act on behalf of the user. At the same time, they restrain from dictating the implementation. The implementers use their creativity and create the given requirements.


Of all the above books, I found Mythical Man Month the most actionable. It has covered all the aspects of software programming in a wonderful way.

I personally admire Warren Buffett's way of working. At 91 years of age, being richest person, his office still has less than 20 people. His calendars remain empty, and he gets to do what he enjoys the most.

The other structure that I admire is the open-source culture. Projects like Django have not only lasted but thrived without having any "leaders." They attract people who love the craft and have a common pain. This is the kind of culture I would like to have!
We had some trivial engineering challenges over last 2 weeks.

Reducing diff speed from 30+ seconds to 300ms
We have a wiki feature at Screener. It allows anyone to modify and add key-insights for companies. In the backend, we use Google's diff-match-patch library. It generates diffs between multiple versions and merges them.

The Python version of the library had a long processing time for some edits. The moderation page was taking over 30 seconds to load.

We found a faster version of the library which is a wrapper around the C++ version. It had a few issue around installation. We fixed those issues and used this library.

While I did expect the loading times to improve, I didn't expect the C++ version to be 100x faster. The page loads in less than 500ms now. Yay!


Forgot Password not working for social logins - Django
We recently discovered that users using social logins (login with Google) were not receiving emails for password reset. The issue was this code:
user = UserAccount.objects.create_user(
    email=email,
    password=None,
    display_name=name,
)
Setting password as None disables password based logins. However, I didn't expect it to not send any email on clicking forgot password. Reading through Django's source code highlighted this issue. We fixed it with:
password = UserAccount.objects.make_random_password()
user = UserAccount.objects.create_user(
    email=email,
    password=password,
    display_name=name,
)


Improved rendering on mobile
We also refactored a lot of base templates on Screener. The text stuck to mobile walls sometimes due to the missing padding. We simplified the templates and fixed the rendering.

Tools and Books

I use MailBrew to generate personalised email digests. It sends me an email every morning of the Tweets of my favourite people. It also includes updates from HackerNews, Lobster, Pinboard network and any RSS feed I provide.

- Feed43 comes helpful when the websites don't have an RSS feed. I use it to generate feeds for MySQL release notes and new feature phones by Nokia. The free version works pretty well for my use case.

- The Mythical Man-month is a book recommended by all the senior programmers, but hardly anyone reads it. I expected it to be dry, outdated and hard. Surprisingly, it is one of the most easy and useful books.

Each chapter starts with a photograph and a quote. Both of them picked very carefully. And they set the theme for the chapter. They also serve as the summary.

The book acknowledges the hard-problem of maintaining the code quality. And it provides some solutions. Solutions that are easy to adapt for a small team like us.

I posted a short summary about it in this blog post.

Thanks for reading. See you again soon :). Will hopefully add a comments feature on the blog in coming days.
This was a busy week loaded with code-reviews, designs, meetings and coffees.

Investor Presentations on Screener

We added a section for investor presentations. It was built on the similar lines as concall transcripts.

The backend was developed by Mukesh and me. The frontend was trickier due to the paucity of space.
Design versions for investor presentation feature


Fun with Aeropress

While I have been pretty happy with the cappuccinos brewed on Bialetti Mukka, I wanted to give black coffee a try. Got an Aeropress this week.

Nothing much else this week.

Paul Graham suggests avoiding matters of money and disputes from taking up our mental bandwidth.  This week had a bit of both.

B2B customers at Screener

We haven't served B2B customers on Screener because of two primary issues.
1. Data rights
2. Complexity

The raw data for personal use is costly. Data for commercial or website use is 20x costlier. And it still comes with certain restrictions. We wanted to have a clarity on these restrictions before we can serve B2B customers.

We also want to keep our team and code-size small. Adding people slows down software innovation and we don't want to get there.

Yet, B2B customers provide a more stable revenue. They also provide a distribution  which is otherwise served by our competitors. We started exploring this B2B landscape this week.

"People" module in Screener

We have a lot of data with names. Names of people in shareholding patterns, bulk deals, block deals and SAST trades. But the data doesn't have any unique id for each name. We wanted to assign person IDs to this data and club common names into a single person. This can cross-link the data from different sources.

We made some progress on this problem this week. We developed a proof-of-concept and linked the names in the shareholding table. The shareholders table on  the company pages uses this new algorithm now.

Tools and Coffee

Sumy -  A Python library for text summarisation
I came across this Python library through Marlene's tweet. It looks pretty slick. I loved reading their documentation for various summarisation algorithms.

KC Roasters - "our coffees are shipped within 24 hours of roasting".
Thanks to Anil for mentioning about them in his newsletter. The good thing is that they also ship small quantities (100gms).
We had a good family get together this week as one of my cousins entered courtship.

Progress on Concall Tools
I have been wanting to extract structured information from concall transcripts. We started by trying to extract the names of various call participants and their associated firms.
We made some progress last week. The algorithm is working pretty well with most concall transcripts now. We increased the test coverage and added 2 algorithms for extracting speakers.

Peoples module on Screener
The larger idea is to create a "people" module on Screener. A way to allow users to "follow" investors. A module which can track and notify updates from different sources:
- quarterly shareholding filings
- bulk and block deals on exchanges
- filings of insider trades
- participation on concalls

This is easier said than done. The problem is that there is no unique person ID in these filings. We have only names. And we need to create a reliable way which links those names to a same particular person in backend.

New line items on Screener
We added a break-up of borrowings in the balance sheets. It will now show the split between long term borrowings, short term borrowings, leased liabilities and other borrowings. Though this is a minor update, it was much needed because of the "leased liabilities" component.
Added break-up of Borrowings on Screener


Disabled updates on Screener by mistake
Adding the new fields on Screener required some data migrations. I had to put the other scripts on hold to complete those migrations manually. However, I forgot the re-enable the scripts after that 🤦‍♂️. This halted a lot of scripts for 1 day:
- Email alerts for watchlists and screens were not sent
- Users didn't receive a welcome email
- Few backend data was not updated

Thinking of creating a menu bar script to alert such cases. I use SwiftBar for writing menu bar scripts.

Books and tools

- Blot: This is a very simple file based blogging tool. Just drag and drop the files in a folder, and your website is up. I am looking for a good low-mentainance setup for creating a website for my wife. She is a dentist and needs a website for her clinic.
- I started reading Antifragile by Nicholas Taleb

Music

I heard Yeh Duniya Agar Mil Bhi Jaye from Pyaasa and started checking other songs by the same lyricist. That's when I discovered the magic of Sahir Ludhianvi. What a collection! And what a story.
Page 1 of 60.
next last »