Attend to Your Mistakes

My daughter is an avid book reader now. She reads more books than I do, but most all her books are fiction. She likes them. This year I challenged her to read at least 5 non fiction books of her choice. She has done three so far and I suggested the book The Little Book of Talent by Daniel Coyle next.

While she was starting with it, I wanted to re-read the book. The book is basically collection of short tips from his research for auther’s other similar books on talent. The best thing about this book is you can read this book in a non linear way.

So I started with this chapter. Here’s excerpt that did resonate with me.

Most of us are allergic to mistakes. When we make one, our every instinct urges us to look away, ignore it, and pretend it didn’t happen. This is not good, because as we’ve seen, mistakes are our guideposts for improvement. Brain-scan studies reveal a vital instant, 0.25 seconds after a mistake is made, in which people do one of two things they look hard at the mistake or they ignore it.

People who pay deeper attention to an error learn significantly more than those who ignore it.

Develop the habit of attending to your errors right away. Don’t wince, don’t close your eyes; look straight at them and see what really happened, and ask yourself what you can do next to improve. Take mistakes seriously, but never personally.

Looking forward to what Anmol will like?

Get All Info About a Python Environment

Conda makes creating environments easy and if you are anything like me, over the course of time you end up having many enviroements and it becomes difficult to knwo what is what.

Basic hygine is to make environemnet names unique and descriptive. But even then knowing what an environment has becomes difficult.

Here’s a general script that I use to get all python related information inside an environemnt

Get all python info:

import sys
import os
import pkg_resources
from pprint import pprint

    'sys.version_info': sys.version_info,
    'sys.prefix': sys.prefix,
    'sys.path': sys.path,
    'pkg_resources.working_set': list(pkg_resources.working_set),
    'PATH': os.environ['PATH'].split(os.pathsep),

Simple and it works.

No One is Bored When They’re Asleep

Some quotes and sayings collected over the last few months.

Taking responsibility (without authority) and creating a positive cycle of generous action. Leading by example. Finding a small corner where you can make a difference–and then making a difference. – Seth Godin

The same is true with all of the initiatives in our culture. Design, movements and ideas are all trapped, waiting to be opened, and then the rest of us will happily pile on – Seth Godin 

A year from now…  Will today’s emergency even be remembered? Will that thing you’re particularly anxious about have been hardly worth the time you put into it? Better question: What could you do today that would matter a year from now? – Seth Godin

When in doubt, go outside. Especially when it’s inconvenient. – Seth Godin 

Your boat, your compass.  – Seth Godin 

A day trader would never take this bet. But a day trader rarely makes an impact. – Seth Godin

Begin with a simple question: What’s it for? – Seth Godin 

Remarkability lies in the edges. The biggest, fastest, slowest, richest, easiest, most difficult. It doesn’t always matter which edge, more that you’re at (or beyond) the edge. – Seth Godin 

Consider surrounding yourself with totems that invite generous action. They’re souvenirs of your best self.  – Seth Godin

You’re only granted so much energy to expend in a lifetime. You’re almost certainly best off focusing it as intensely as you can on the targets that seem to really move the needle.  – Cal Newport 

Next time, take the lead. Not because you have to, but because you can – Seth Godin 

When we have alternatives, we compromise instead of commit. – Seth Godin 

Find someone who has already optimized for the reality you’re about to enter and learn from them. –Seth Godin 

Bored means that you’re paying attention (no one is bored when they’re asleep.)  -Seth Godin 

After you do the reading, then what are you going to do? Good judgment and a thoughtful point of view are now scarce assets worth seeking out. What have you done with what you’ve learned?  – Seth Godin

Looking back is an essential part of moving forward. – Azure Devops docs

People almost always want a smile, a kind word or a hand up sooner than we think and for longer than we imagine. – Seth Godin 

Your customers don’t care what it took for you to make something. They care about what it does for them. – Seth Godin 

Starter Argparse and templates

I tend to develop my python scripts as small apps, this way I can call and use them from every where in command line without relying on the calling the python scripts

Here’s a template of the and argparse template that I always start with. example is for making the application as a package and installable.

Install_requires is a list of packages required by the app.
Entry_points is optional if given, app can be called using the ‘app_name’ from command line.

import os
from setuptools import find_packages, setup
    name= 'name',
    description= "This is the description",
    author= "author_name",
    author_email= "author_contact_email",
    install_requires=["psutil", "pywin32"],
        'console_scripts': ['app_name = app:main']

Argparse example template

Following a starter template for using argparse.

def main():
    parser = argparse.ArgumentParser(
        description="Pro Thermals: Uses Iges from NX Update to perform thermal analysis on scenery Model")
    parser.add_argument("indir", type=str, help="Input dir ")
    parser.add_argument("outdir", type=str, help="Output dir ")
    parser.add_argument("-s", "--scpath", type=str, help="simulation executable path ",
    parser.add_argument("-o", "--omp-threads", type=int, help="Specifies how many OMP_NUM_THREADS app uses while running ",
    args = parser.parse_args()
    input_dir = args.indir or os.getcwd()
    output_dir = args.outdir
    if not os.path.exists(output_dir):
    run_ok = db_thermals(input_dir,
                         args.scpath, args.omp_threads)
if __name__ == "__main__":

In the above example, indir and outdir are required positional arguments, while scpath and omp-threads are optional arguments with some defaults.


Few Useful Conda Commands To Get Started.

Conda is a tool for managing and deploying applications, environments and packages.

I use conda a lot. It has lot of functionalities and there is lot to learn in it but for regular usage, there are just few things that they need to know to use it productively.

so here’s a list of commands that I had shared with my colleagues to get them started in conda.

This commands will just be enough to get the ground running and do most of the stuff.

Few useful conda commands

  • conda env export –f env.yml -> Exports the environment in env.yml file
  • conda env remove -n env_name -> Remove a environment
  • conda create –yes -n env_name python=3.5 -> Create an environment with python 3.5
  • conda info –envs -> List all environments
  • activate env_name -> activates environment
  • deactivate -> deactivates the current environment
  • conda install package_name -> install a package in the current environment
  • conda uninstall package_name -> uninstall a package in the current environment

Subtraction the real engine

Have been thinking of these three quotes, over the last few weeks….

Blaise Pascal famously ended a letter with, “I would have written a shorter letter, but I did not have the time.”

Another quote comes from Antoine de Saint-Exupery: “Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.”

“So knowledge grows by subtraction much more than by addition given that what we know today might turn out to be wrong but what we know to be wrong cannot turn out to be right, at least not easily.” – Nassim Nicholas Taleb in Antifragile