Books

This is the word cloud of the books I have read in 2019.

Here’s the list of the books.

  • Atomic habits by James Clear
  • My India by Jim Corbett 
  • Scale by Geoffrey West (A)
  • The happiness equation by Neil Parsricha
  • Think like Sherlock by Peter Hollins
  • Science of likability by Patrick king
  • Antifragile by Nassim Nicholas Taleb
  • Alchemy of air by Thomas Hager
  • E=mc2 by David Bodanis
  • The secrets of happy families by Bruce Fieler
  • Wine by Rod Philips
  • The ghost map by Stephen Johnson
  • No one at the wheels by Sam Schwartz
  • Digital minimalism by Cal Newport
  • Farsighted by Stephen Johnson
  • Skin in the game by Nassim Nicolas Taleb
  • Gold by Mathew Hart
  • India conquered by Jon Wilson
  • When by Daniel H Pink
  • What Adam Smith can teach you Russ Robert
  • Science of food by Marty Jobson
  • The flight attendant by Chris Bohjalian (F)
  • Power of moments by Dan and Chip Heath
  • Spy school by Stuart Gibbs (F)
  • The memory code by L Kelly 
  • Fibre by Susan Crowford
  • An appetite for wonder by Richard Dawkins
  • How to have a good day by Caroline Web
  • The perfect bet by Adam Kucharski
  • The inmitibale Jeeves by P G Wood house (F)
  • The neuroscience of mindfulness by Stan Rodski
  • Humble pie by Matt Parker
  • The doomsday machine by Michale Lewis
  • Humans a brief history of how we f*cked it all up -Tom Philips
  • The Success Equation: Untangling Skill and Luck in Business, Sports, and Investing by Michael J. Mauboussin
  • The ape that understood the universe by Steve Stuart Williams (A)
  • The Little Book of String Theory by Steven Scott Gubser
  • Creating the Twentieth Century: Technical Innovations of 1867-1914 and Their Lasting Impact by Vaclav Smil
  • The passengers by John Marrs(F)
  • Range: Why Generalists Triumph in a Specialized World by David Epstein
  • Our mathematical universe by Max tegmark
  • The big shot by Michale Louise
  • The one by John Marrs (F)
  • I contain multitudes by Ed Yong
  • The Subtle Art of Not Giving a F*ck by Mark Manson
  • The LEFT BRAIN SPEAKS The RIGHT BRAIN LAUGHS By Ransom Stephens
  • Logic of life by Tim Hartford
  • It all adds up by Mickale Launy
  • Birth of a Theorem: A Mathematical Adventure by Cédric Villani
  • Digital minimalism by Cal Newport
  • Cubed secret history of the office by Nikil Saval
  • Cities the first 6000 years by Monica L Smith 
  • Ultralearning by Scott young
  • Everyday biases by Ross Howard J
  • Rebel ideas by Matthew Syed(R)
  • Why we sleep by Matthew Walker
  • Pleased to meet me by Bill Sullivan 
  • The greatest show on earth by Richard Dawkins
  • Math on the back of the envelope by Rob Eastaway
  • Idiot brain by Dean Burnnet
  • Pig wrestling by Pete Lindsay
  • Replay by Kin Grimwood (F) 
  • Elon musk by B Storm
  • Meet your happy chemicals by Loretta Buenning
  • Genesis by Robin Cook (F)
  • Indistractable: How to Control Your Attention and Choose Your Life by Nir Eyal

My top favorites

  • Why we sleep by Matthew Walker
  • Replay by Kin Grimwood
  • Rebel ideas by Matthew Syed
  • The ape that understood the universe by Steve Stuart Williams
  • India conquered by Jon Wilson
  • The ghost map by Stephen Johnson
  • Skin in the game by Nassim Nicolas Taleb
  • The Subtle Art of Not Giving a F*ck by Mark Manson

Sound Alarm When Program Execution Completes in Python

Often one faces a situation where your code takes extremely long to run and you don’t want to be staring at it all the time but want to know when it is done.

In engineering analysis, simulation take a long time to run and the python driver program take a long time to finish and I face this problem a lot.

A simple solution is adding a beep at the end, here’s how to do it in python.

def beep():
    print "\a"

beep()

works on windows/ linux/mac without any modification.

via here

Kids painting

This year started with no internet at our house.

On the evening of 27th December, a day after Boxing Day, the Internet of the home suddenly went down and it remained down till 2nd January.

This is the first time after so many years that the family as a whole has experienced such forced internet break.

For the first time 10 hours, as a family we had looked at the internet router more than in the last 5 years combined.

For the first time everyone had more time than we ever realized. So we started painting, rediscovered board games and kids completed thrice the number of books that they did with internet on.

Painting by kids.

Hope to curve out few days like this again?

Find Disk Usage with shutil

As I move to python as my primary programming language, I am discovering new things about the modules that i have used for many years, one such module is the shutil.

To check free disk space, one can use the following command

  _, _, free = shutil.disk_usage("")

shutil.disk_usage returns the disk usage statistics about a given path

Returned values is a named tuple with attributes ‘total’, ‘used’, ‘free’, which are the amount of total, used and free space in bytes.

How to set persistent environment variables with command line in windows

Environment variables are not often seen directly when using Windows. However there are cases, especially when using the command line, that setting and updating environment variables is a necessity.

I always new the set command line command to set environment variables in windows, but to make a system wide effect of the environment variable, this command needs users to logout and login again.

To set persistent environment variables at the command line, we can use setx.exe. It became part of Windows as of Vista/Windows Server 2008.

setx.exe does not set the environment variable in the current command prompt, but it will be available in subsequent command prompts.

for more info type the following in the windows command

set /?

or

setx /?

Shelve it with python

One of the little gems hidden in python standard library is shelve.

The shelve module can be used as a simple persistent storage option for Python objects when a relational database is overkill. The shelf is accessed by keys, just as with a dictionary. The values are pickled and written to a database created and managed by dbm.

import shelve

with shelve.open('test_shelf.db') as s:
    s['key1'] = {
        'int': 310,
        'float': 3.14.5,
        'string': 'Sample string data',
	'array': [[1,2,3],[4,5,6]],
    }

I mostly work with large simulation data and run simulation from python and these simulations take time to run sometimes days, so a simple persistent storage option provided by shelve is an intuitive way to restore my work.

An advantage of is we do not have to remember the order in which the objects are pickled, since shelve gives a dictionary-like object.

Here’s a sample code I use to store my long running results and latter to restore those values at a later time.

filename=r"flake_results.out"

my_shelf = shelve.open(filename, "n")

for key in ["stress", "strain", "plas", "creep","temp"]:
	try:	
		my_shelf[key]=globals()[key]
	except Exception:
		print ("Error shelving: {}".format(key))

my_shelf.close()

To restore

my_shelf = shelve.open(filename)
for key in my_shelf:
    globals()[key]=my_shelf[key]

my_shelf.close()

for more info: Visit This