Let It Snow- the python code.

Last month posted this gif image of the snow animation done using matplotlib. As promised, here’s the code. Done using excellent animation capabilities of matplotlib.

The code can be used as a module as follows

from snowfall import Snowfall

snow = Snowfall("Happy Holidays").show()

Here’s the output.

Let It Snow Happy Holidays

Love the ease with which it can be done. The code is very generic and can be used to make any generic message with snowfall animation.

Here is the code for this. Also available at this gist

Continue reading

Books Read in 2021 – Part 1

Like most people, due to pandemic, due to working from home, I have worked from various different places last year.

My most reading used to happen during office commute, so reading time was already down. And this movement from one place to another reduced this further. This reflects in the number of books I have read.

Here’s the rundown of the books I liked and read through in 2021.

Gut by Giulia Enders.
My 3rd book on the subject and by far the most interesting and something that I have enjoyed and learnt a lot. Have wrote a few posts regarding this book last year. A tale of the most underrated organ of the body.

Why we Eat (too much) by Andrew Jenkinson.
Written by a doctor, this has surprisingly good insights. Have added a few of this book’s insights to my life. Good to see how eating habits, the structure of cells and environments all come together.

The Snowball: Warren Buffet and the Business of Life by Alice Christie.
This book was long pending. Did not want to start as I thought I already know a lot about Warren Buffet. But boy I was wrong. A good portrait of the oracle of Omaha. Must read for anyone interested in investing and in life lessons. Have posted a few insights from the book here in this blog post.

The Thirteen Problems by Agatha Christie.
One of the things I miss about the UK is the TV shows portraying Agatha Cristie’s detectives. Picked this book to reminisce about the old days. This book has 13 simple mysteries. I loved most of them. Does anyone know of a contemporary author who writes in this genre?

The Oxygen Advantage by Patrick Mackeown
Started reading this after a blog post. Simple idea but the author took a long time harping on this. A simple idea beat to death by repetition. Also, there’s a slant of marketing in the book which was offputting.

How long is a piece of String by Rob Eastaway
It’s a book on maths. Marrying common sense with mathematics and tying all this through very common examples from daily life. I will reread this again.

Upstream by Dan Heath.
This was my first and only audiobook this year. We tend to downplay the preventive measures and this book shows why we shouldn’t. Lots of good stories and a lot of insights. Nudged by this book, I solved a few long-standing minor annoyances of daily life.

Sapiens by Yuval Noah Harari.
Re-read this book. I recommended this book in one of the office daily standups and went ahead re-reading it. A highly recommended book.

From Gutenberg to Google by Tom Wheeler
A book on the spread of communication systems. I loved this book. The history buff in me was satisfied in reading how people were reacting to new tech. Found many parallels to how the current techs like crypto/AI/ML and how we are reacting to it. Tie it with this post Machine Learning – Thou aimest high

How to Decide by Annie Duke.
Disappointed. Annie Duke’s last book thinking in bet was way way better. This one was like a sermon.

7 Mistakes every investor makes by Joachim Klement.
A good read. Learnt a few new things and reinforced a few old concepts. This is the time I decided I will read one investment-related book a month.

Never split the difference by Chris Voss.
I had this book with me for 2 years now but never felt any desire to pick this up until this year. But boy I was surprised. A good book on negotiations and human behaviour in general. Kept me thinking. I will re-read it again.

A world without email by Cal Newport
A good read. Much before reading this had implemented a system for kids to study using the nudge from the book upstream. This is a book I will revisit again.

A Triump of Genius by Ronald K Fierstein
A long book on the life of Edwin land and Polaroid. An inside view on how the legal system for industrial disputes between Kodak and Polaroid played out. A good read to see how companies react when disruptions happen. Very relevant for the current times.

I think this is enough for now. More in the next post.

Few past book related posts listed below.

How Not to Miss any Outlook Appointment -Introducing Email Butler

I work on two PC’s. One is my local machine and another is a virtual remote desktop (VDI) machine where I connect remotely. The remote machine is where I spend most of my workday but the local machine has the primary email where all office-related meetings and other communications come by.

So have to manage and monitor two emails, this was hard and the context shift was enormous. And there was always a case that I missed many meetings just because I was working in the VDI machine.

So desperately needed a butler who can notify me of my emails and meetings in the local system when I was working on the remote system

As always turned o python for a solution. Here’s the result. A simple email_butler that monitors my email and calendar and keeps me up to date.

Combined with the winsay library package, this app is launched at a local system startup and I don’t have to keep an active eye on my local email.

How does this work, the system monitors the calendar entries every five minutes and informs the user if there is any new upcoming event/meeting coming in the next 30 mins.

How can you use this?

pip install git+https://github.com/sukhbinder/Email_Butler.git

and then add this batch command in your windows startup.

start ebutler

The added advantage of this setup is I don’t have to constantly look at my email anymore as I trust the email butler doing the work for me. 😛

Useless Tree

Photo by Pixabay on Pexels.com

A carpenter and his apprentice were walking together through a large forest. And when they came across a tall, huge, gnarled, old, beautiful oak tree, the carpenter asked his apprentice: “Do you know why this tree is so tall, so huge, so gnarled, so old and beautiful?” The apprentice looked at his master and said: “No…why?”

“Well,” the carpenter said, “because it is useless. If it had been useful it would have been cut long ago and made into something else. But a boat made from it would sink, a coffin would soon rot, a tool would split, a door would ooze sap, and a beam would have termites. It’s worthless timber and is of no use. That is why it has reached such a ripe old age.

And it’s exactly because it is useless that it could grow so tall, majestic and so beautiful and that you can sit in its shade and relax on a hot day. No one seems to know how useful it is to be useless like this beautiful tree.”

He went on to say “What is it to be useless? It is to be free of striving to become something, to be someone special or to prove yourself. To be useless is simply to relax as you are, to rest at ease, to abide in your true nature in an easy way.

When there is nothing to do, nothing to be, and nothing to attain; When we truly let go of any need to be a certain way, leaving everything alone, then we are truly free, like the tree.”

from ando.life

I love this parable. It’s an important reminder of how often our sense of self-worth is hitched to being ‘useful’ to someone else. We’re often evaluating how useful we are to a company, to our partner, to our community, to our friends, to our family, to the world.

Net Use to Your Rescue

Using mapped drives and location is a common task in office work. With Work from home, connecting to remote drives etc has become much more prevalent.

So it makes sense to learn about the command net use from windows. The net use command is a Command Prompt command used to connect to, remove, and configure connections to shared resources, like mapped drives and network printers.

Execute the net use command alone to show detailed information about currently mapped drives and devices.

To map a location to drive as a Temporary Mapped Drive

net use * "\officeserver\docs" /persistent:no

In this example, we used the net use command to connect to the docs shared folder on a computer named officeserver. The docs folder will be mapped to the highest available drive letter [*], but we don’t want to continue mapping this drive every time we log onto the computer, hence [/persistent:no].

Working on a remote desktop, the net use command has been very useful.

What other commands do you use in your system?

The Best Explanation

I don’t know anything about Quantum Physics. I know about the terms but I don’t understand them. have read quite a few of the books, but it’s all a mystery.

Start your 2022 with this nifty little video that is one the best explanation of the double-slit experiment.

Do you know of any such videos, do share them with me. I love them.

Happy New Year

No matter how hard the past is, you can always begin again.

—Jack Kornfield

Thank you for reading, sparing your time and attention to this blog.

Happy New Year. Wishing you and yours a happy, healthy, and prosperous 2022.

PS: The fireworks gif above is created with matplotlib in python, code coming soon. 🙂

What are We Overlooking Now?

The aeroplane would be at least in top five in the list of the most important inventions of the 20th century. The airplane changed everything. It started world wars, it ended world wars. It connected the world, bridging gaps between cities and rural communities; oceans and countries.

The Wright brothers, Orville and Wilbur, were two American brothers, inventors, and aviation pioneers who are credited with inventing and building the world’s the first successful airplane and making the first controlled, powered and sustained heavier-than-air human flight, on December 17, 1903.

From 1905 to 1907, the brothers developed their flying machine into the first practical fixed-wing aircraft. Although not the first to build and fly experimental aircraft, the Wright brothers were the first to invent aircraft controls that made the fixed-wing powered flight possible.

Last week 17th December, my Twitter stream was filled with pictures of wright brother’s achievement. This reminded me of the story I read in the book Psychology of Money by Morgan Housel.

The story of the Wright Brothers’ quest to build the first plane has an interesting twist. After they conquered flight, no one seemed to notice. Nobody seemed to care.

In his 1952 book on American history, Frederick Lewis Allen wrote:

Several years went by before the public grasped what the Wrights were doing; people were so convinced that flying was impossible that most of those who saw them flying about Dayton [Ohio] in 1905 decided that what they had seen must be some trick without significance – somewhat as most people today would regard a demonstration of, say, telepathy. It was not until May, 1908 – nearly four and a half years after the Wright’s first flight – that experienced reporters were sent to observe what they were doing, experienced editors gave full credence to these reporters’ excited dispatches, and the world, at last, woke up to the fact that human flight had been successfully accomplished.

Even after people caught on to the plane’s wonder, they underestimated it for years.

First, it was seen mainly as a military weapon. Then a rich person’s toy. Then, perhaps, used to transport a few people.

If such a momentous event was overlooked, what are we overlooking now?

PackagesNotFoundError error with conda

In August last year received a new laptop from the office. It came with bare bone python installation, so installed anaconda on it.

But faced this particular issue while installing packages for a specific environment

(py35) C:\Users\sukhbinder>conda install numpy=1.11.3 mkl=11.3.3 matplotlib=1.5.3 psutil=5.4.7 numexpr=2.6.1 h5py=2.6.0 hdf5= pandas=0.23.3 pytables=3.2.2 python=3.5.2 python-dateutil=2.5.3 setuptools=27.2.0 vc=14.1 vs2015_runtime=15.5.2 zlib=1.2.11 bzip2=1.0.6
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - vs2015_runtime=15.5.2

Current channels:

  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch

After much googling and huffing and puffing, found the solution that worked.

conda config --set restore_free_channel true

and then

conda install numpy=1.11.3 mkl=11.3.3 matplotlib=1.5.3 psutil=5.4.7 numexpr=2.6.1 h5py=2.6.0 hdf5= pandas=0.23.3 pytables=3.2.2 python=3.5.2 python-dateutil=2.5.3 setuptools=27.2.0 vc=14.1 vs2015_runtime=15.5.2 zlib=1.2.11 bzip2=1.0.6

That’s it. Posting it here in the hope it might help someone.

Let It Snow – Revisited

As we enter the holiday season and into the new year, wanted to revisit an old post that I did back in 2011 with the same title but the animation was done in FORTRAN.

Here’s a similar implementation in python and matplotlib. In Fortran I needed pgplot for the animation, in python, only standard packages were enough.

Happy Holidays to everyone and have a Grand New Year.

If you are interested in the code, wait till the next year will post it soon.

Treemap in Python

Tree Maps are primarily used to display data that is grouped and nested in a hierarchical. A treemap is one method to simultaneously display the magnitude of the major categories – as well as the magnitude of the larger subcategories in one visualization.

Ben Shneiderman introduced treemaps in the early 90s as a visualization metaphor for displaying hierarchical trees. A treemap arranges hierarchical items in rectangular bounding boxes representing the tree structure. The rectangles of a treemap are called cells.

Cells on the treemap have three visual attributes:

  • The colour of a cell is a visual representation of a measure
  • Its size can also represent another measure.
  • The location of a cell indicates which parent cell it belongs to (Spatial Relationship)

This is what Ben Shneiderman had to say on his motivation to come up with this visualization.

During 1990, in response to the common problem of a filled hard disk, I became obsessed with the idea of producing a compact visualization of directory tree structures. Since the 80 Megabyte hard disk in the HCIL was shared by 14 users it was difficult to determine how and where space was used. Finding large files that could be deleted, or even determining which users consumed the largest shares of disk space were difficult tasks.


Python has an excellent package called squarify, which can be installed from pypi

Here’s a simple example to use squarify to create a treemap in python.

import squarify
import matplotlib.pyplot as plt

data={'Reserve': 363.0,
 'OtherA': 240.0,
 'Assets': 154.0,
 'Other': 117.0,
 'Debt': 109.0,
 'SC': 88.0,
 'Investments': 72.0,
 'CWIP': 10}

squarify.plot(data.values(), label=data.keys())
plt.axis("off"); plt.show()

I am using this a lot in the last few days, really good.

Read more


Photo by Akil Mazumder on Pexels.com

First few proclamations that people-in-the-know were wrong about.

“This ‘telephone’ has too many shortcomings to be seriously considered as a means of communication.” — William Orton, Western Union, 1876

“Television won’t be able to hold on to any market it captures after the first six months.” — Darryl Zanuck, 20th Century Fox, 1946

“The Americans have need of the telephone, but we do not. We have plenty of messenger boys.” — William Preece, British Post Office, 1876

Michigan Savings Bank warned Henry Ford’s lawyer Horace Rackham to protect his money. “The horse is here to stay but the automobile is only a novelty—a fad,” 

Why did they all fail to see the change?

Every one of them was too close to the problem, was too much invested in it and the change was slow and gradual. Remember the boiling frog.

Slow changes, both in improvements and in deteriorations, get magnified over time. But over short periods of time, they are barely noticeable.

As the year winds down, this is the perfect opportunity and time to ponder on slow gradual changes happening in our lives.

Three more useful Conda commands

Conda is my go to python environment management tool. I have talked about it here.

Eventually as you use the conda commands, your environments become bloated, have stuff you no longer need or know. Recently saw an example of this on my old vdi system.

Here are three useful commands in conda to reign in this bloated beasts.

Remove unused cached files including unused packages in Conda

conda clean –all

List all revisions made in the active environment

conda list –revisions

Restore an environment to a previous revision

conda install –name ENVNAME –revision

Hope this helps. It surely helped me.

India’s Digital Revolution

Here’s a snapshot from Vodaphone India’s Investors presentation.

Those of us living here and walking on the streets see this all the time.

A year ago, I was reluctant to try any of these digital payments. Coming from the UK I wasn’t sure how secure they were but now using UPI to pay for buying a plate of idly samber to paying for the Honda Activa is the go-to solution.

The rise of UPI shows how reducing fiction enhances the experience and explodes usage.

The question is where will this trend lead?

Backing up Files using OneDrive

My employer provides Microsoft OneDrive to keep the works files safe. Anytime I call the IT department, for any fix in the laptop, they always ask “Is your files backedup in OneDrive in case we might need to re-image the system” Reimage, whatever that is. I always mumble yes.

This always reminds me to backup my files on the desktop, so I do it on that day. But having done this a couple of times, I have finally created a batch file using robocopy which does the job every week.

Here’s the batch file that I use.

@echo off
cd C:\Users\sukhbinder.singh
robocopy Desktop "D:\sukhbinder.singh\OneDrive\backup" /e /mir /np /tee /mt /log:d:\backup_log.txt

And all this is scheduled using the schtasks and runs multiple times a week.

Holiday Books Recommendations by Bill Gates

I like books recommendations posts. Most of the books that I read come from these sources. One of the consistent recommendations comes from Bill Gates.

His recommendations are almost always paired with a video. For the current recommendations, he had such a good video that I couldn’t help posting it here.

Haven’t read any of the books mentioned in the video but three of them are on my reading list for the coming year.

What’s your pick on or off the list?

If you liked this, you might like these…..

How to get Query Parameters from a URL in vuejs


Faced this problem while building the app for kids reviews.

The app needed the subject id from the URL. How to do this?


The solution is to use URLSearchParams

The URLSearchParams interface defines utility methods to work with the query string of a URL.

This is available for all modern browsers except Internet explorer.

So here’s the solution I used for the app.

var vm = new Vue({
       let urlParams = new URLSearchParams(window.location.search);
           console.log(urlParams.has('subject')); // true
           console.log(urlParams.get('subject')); // "3"

Simple stuff but these things never show up in any tutorials unless you are working on a real project.

The Freak Became the Norm

Recently reread the book The Gene By Siddhartha Mukherjee. It’s an extremely well-researched book. Dotted with the right amount of details and stories about so many characters who are part of humanity’s discovery of genes.

Here’s a beginning extract for the flavor of the book

Darwin could almost see the process unfolding on the salty bays of Punta Alta or on the islands of the Galápagos, as if an eons-long film were running on fast-forward, a millennium compressed to a minute. Flocks of finches fed on fruit until their population exploded. A bleak season came upon the island—a rotting monsoon or a parched summer —and fruit supplies dwindled drastically. Somewhere in the vast flock, a variant was born with a grotesque beak capable of cracking seeds. As famine raged through the finch world, this gross-beaked variant survived by feeding on hard seeds. It reproduced, and a new species of finch began to appear. The freak became the norm. As new Malthusian limits were imposed—diseases, famines, parasites—new breeds gained a stronghold, and the population shifted again. Freaks became norms, and norms became extinct. Monster by monster, evolution advanced.

Read somewhere that books are paper-ships that take you on a journey. This book definitely does that. Highly recommend.