Tuesday, 11 April 2017

The New One Minute Manager book review

Just like many other business books this book also has a very low signal/noise ratio. Almost all of the first 2/3rd of the book is just self-promotional stuff, about how this entitled manager is everyone's favourite because he follows one-minute management techniques. One minute employee goal reviews, one-minute problem resolutions, one-minute performance review. Guess how much he lasts in bed?

But the book gets better from chapter 11 onwards. Here are some key insights that follow.

1) Many managers have the habit of gunnysacking the feedback to their employees. That is, storing up observations of poor behaviour until frustration builds up, and when that happens they release it all in a dump all at once. Things don't go so well on the receiving end,  too much info, too much fact checking to combat rationally, and the employee naturally becomes defensive, defending her actions to the point of distorting facts even, and not owning what was done wrong, leaving the discussion resentful.

2) Being Tough and Nice is better than being Nice and Tough. There was once an emperor in China, who called his Prime Minister (second in command) and said to him "Why don't we divide up the tasks, you do all the punishing and I will do all the rewarding". PM said OK. Some time went by, the empereor realised that people would ignore his orders (coz of his rewarding nature) but would strictly obey the PM's orders. So the Emperor called the PM again and ordered him "Why don't we divide the tasks again, you do all the rewarding, and I shall do all the punishing.". PM said OK, and they switched roles. Within a month there was a revolt. The emperor had been a nice and rewarding person, and now he suddenly started punishing people left and right. People said "What's up with this old codger?". When they came to look for a replacement, guess who they chose ? The PM, who had won people over his recent change of heart from ruthless to kind and rewarding.

Monday, 10 April 2017

Tuesdays with Morrie Book review

Have you ever had a teacher, one that saw you as a raw but precious thing, a jewel that, with wisdom, could be polished to a pound shine? If you are lucky enough to find your way to such teachers, you will always find your way back.

This book is about one such teacher and a faithful student, who comforts and listens and documents the learning of his teacher in his last days.

Here are some key insights from the book.

1) The most important thing in this world is to learn ways to give out love to the world. Love in its purest form, unconditional and without a contract.

2) “The tension of opposites:
Life is a series of pulls back and forth. You want to do one thing, but you are bound to do something else. Something hurts you, yet you know it shouldn't. You take certain things for granted, even when you know you should never take anything for granted.

A tension of opposites, like a pull on a rubber band. And most of us live somewhere in the middle.”

3) Morrie speaks a great deal about dealing with Death and making peace with the fact that it is coming soon. "Only when you're about the die is when you start to live." ~Morrie

4) We spend our lives sleep walking, looking at life through a keyhole. Only at the thought of death, does the keyhole widen and we begin to see the larger picture. The other way to widen the keyhole is by out of this world experiences and by analysing past. Imagine looking back to your past and thinking about something you will realise that there were so many aspects of reality you completely overlooked. Life is a series of decisions and many of these decisions we make with little information. Death is the ultimate bottom line which forces our mind to think objectively.

5) For most people, if it feels like the truth, that's enough for them, that all they ever will need.

I have decided a little thought experiment for myself, to not allow myself to fall into the comfort of believing things because of socially dictations.
Whenever I'm talking to someone and they offer a view, I always force myself to take an opposite stance on the view, if they are against GMO I'm pro-GMO, if they are for capitalism, I romanticise about socialism. Sometimes I lose sometimes I win, but I learn every time, and that learning is far more than the learning from just agreeing to someone's views. As Marc Andersson says, ideas should be free of ego.

6) The importance of family

Except for the two-three good friends you have ( if you're lucky) and your close family no one really gives a fuck about you, no matter how important you think you are.
The family will stay at your side in wealth, health, sickness and bankruptcy. The family is perhaps the most underrated support system institution.
Only once you've realised the importance of it, can you truly become a man, and think about starting a family of your own.

7) Investment in building your own culture around you

After a time you realise that the doctrines of your culture which you believed to be absolutely are actually not so. This realisation is more profound and direct when you go to new countries and spend time in a new culture. So the author says that its essential that you invest in building your own little culture around in your life. Less TV more conversation, less buying useless stuff and more giving. Less of planning more spontaneity. It could be whatever you like.
Running away is not the solution, every culture has its flaws and sooner or later they will make themselves visible in strong ways, it's foolish to assume that any culture is perfect

This book is a great one time read, I give it 3.7/5 rating.

Saturday, 9 May 2015

On reddit

The community is overall nothing short of awesome.

Although, the popular subs are an exception to this rule, they are filled with the circlejerk that we define as "NORMAL" and all the outlier cases are the bad ones, although some niche subreddits are exact opposite of this, and haven't actually changed much in 2 years(2013 when I first joined reddit).

Also, its the little things that redditors do as a community, my favorite is how r/trees and r/marijuanaenthusiasts subs are swapped.

Tuesday, 7 April 2015

Python Notes

Some python notes for pre-interview revision

Range vs Xrange

xrange is a sequence object that evaluates lazily. range creates a list, so if you do range(1, 10000000) it creates a list in memory with 10000000 elements. xrange is a generator, so it is a sequence object is a that evaluates lazily.


  • Immutable
  • s = ("a","b","c") #paranthesis are optional
  • Indexing support just like lists
  • print(1,2,3) #prints 3 numbers
  • print((1,2,3)) #prints a tuple
  • a = () #empty tuple
  • a = (2,) #singleton tuple
  • a,b = interprets the result of the expression as a tuple with two values.
  • a,b = b,a #swaps the variables
  • a,b = [1,2] #obvious
  • a,b = [1,2,3] #ValueError : Too many values to unpack
  • a,*b = [1,2,3] #a=1 and b=[2,3]


  • A hash map, key value pairs, is unordered.
  • Keys must be unique and only consist of immutable objects like strings


  • Lists, strings and tuples are example of sequences.
  • Supports "Membership Tests" : (for i in arr, for i not in arr)
  • Supports Indexing Operations and Slicing


  • Unordered collection of simple objects
  • Supports test for membership


  • arr = [1,2,3]
  • arr2 = arr
  • arr3 = arr[:] #this makes a copy by full slicing
  • del arr[0]
  • print arr2 #[2,3]
  • print arr3 #[1,2,3]
  • Explaination: Assigning a variabel name to another variable name just makes creates a reference to the original object. If you want to make a completely new object and not just a reference then you have to use copy.

Object Oriented Programming


  • Objects that belong to the class or the instance of the class are called fields.
  • Objects that belong to the class are called class variables and objects that belong to the instance of the class are called instance variables.


  • Python equivalent of this pointer in C++ or this reference in java and C#.
  • The name self can be changed to something else also, although its not recommended you do that.
  • Self is used to create a reference to the object being created of the class, so a call like 'myobject.method(arg1,arg2)' gets internally inflated as 'MyClass.method(myobject,arg1,arg2)'
@staticmethod decorator
  • Those methods which belong exclusively to the class and not its instances

Implementing Inheritance

  • class SchoolMember():...
  • class Teacher(SchoolMember):...

Special Methods in Classes

  • __inti__(self, ...) : Called right before the newly created object is returned for usage.
  • __del__(self) : Called just before the object is destroyed.
  • __str__(self) : Called when we use the print function of when str() is used.
  • __lt__(self,other) : called when less than operator is used (<), Similarly there are methods for all the operators (+,>,- etc)
  • __getitem__(self,key): Called when x[key] indexing call is made. 
  • __len__(self) : Called when the built-in len() function is used for sequence object.


  • Else: this block is executed in the case everything is fine and no exceptions occur.
  • Finally: this block is executed when all the exception cases are met and the interpreter is about to exit the try block

User defined Exception Class

class ShortInputException():
    def __init__(self,length,atleast):
        self.length = length
        self.atleast = atleast

#Now lets raise this exception
if len(text) < 3: raise ShortInputException(len(text),3)

Lambda Expression

  • A lambda statement is used to create new function objects.

points = [{'x':2,'y':30},{'x':1,'y':9}] 
points.sort(key=lambda i : i['y']) 
[{’x’: 1, ’y’: 9}, {’x’: 2, ’y’: 30}]

Recieving tuples and dictionaries of indefinite lengths in functions

oints.sort(key=lambda i : i['y']) 
def sum(*args): 
    ''' Returns the sume of all the parameters ''' 
    return sum(a)
>>> 113

Because we have a * prefix on the args variable, all extra arguments passed to the function are stored in args as a tuple. If a ** prefix had been used instead, the extra parameters would be considered to be key/value pairs of a dictionary.

The Assert Statement

def sum(a,b): 
    assert type(a) == int 
    assert type(b) == int 
    return sum(a,b)

Tuesday, 31 March 2015

How to remove a package in ubuntu when you don't know its name ?

So I had this ubuntu alarm clock app installed, which I wanted to remove, but I couldn't find its package name.

So here is the command to figure out the package name of an installed app 

dpkg --get-selections | grep 

And woot, I've found it. Now lets get rid of it.

sudo apt-get purge alarm-clock-applet

Ideas and Memory tradeoff

I have a hypothesis that there exists a tradeoff in the mind between the tendency to think big,bright ideas and being able to recall them later.

Explaining this further, the brighter and more revolutionary the idea you just thought of, the lesser are the chances that you will be able to recall it by the time you decide to work on it.

But with maturity and practice, this tradeoff must fade off, that's why people who are in the profession of implementing ideas liek artists, writers, musicians produce the best work of their lives after much much practice.

To cite a famous example, Douglas Adams, once was presumably high and was having a lunch conversation with his friend, during this conversation, Adams told him three ideas, one of them was the book “The Hitchhiker’s guide to the galaxy”. 
They realised the importance of these ideas and knew instantly that they were profound.

When they met later, they forgot the two ideas except for the "Hitchhiker's guide to the galaxy" one.
None of them was able to figure out, what the rest of the ideas were, except for the fact that they were equally revolutionary.

Now imagine what the other two ideas might have been.

Source : A documentary titled "Life, Universe and Doughlas Adams"