Python Cheet Sheet
Cheat Sheets

A quick cheatsheet on python operations Slice: astring = "Hello World" print(astring[3:7]) # prints-> lo w print(astring[0:10:2]) # skips one character, prints -> Hlowr print(astring[::-1]) # reverse a string using step -1 Case astring.upper() astring.lower() Slicing complete list performs a copy spam_copy = spam[:] Zip to loop furniture = ['table', 'chair', 'rack', 'shelf'] price = [100, 50, 80, 40] for item, amount in zip(furniture, price): print(f'The {item} costs ${amount}') Multiple assignments...

January 2, 2023

Grit - Angela Duckworth
Book Summary

Book Summary - Grit by Angela Duckworth The post is a book summary of the main bullet points from the book “Grit” by “Angela Duckworth” Components of Grit Angela breaks down grit in the following components:- Interest: I love what I do Practice: I will do what it takes to improve and become world-class Purpose: What I do is important for everyone Hope: I will keep going even when it’s difficult...

December 12, 2022

Largest Area Under a Histogram (and related concepts/problems).
Algorithms

Problem Statement: GfG quoted: Find the largest rectangular area possible in a given histogram where the largest rectangle can be made of a number of contiguous bars. For simplicity, assume that all bars have same width and the width is 1 unit. The Clever Solution Sometimes, the nicest solutions come from clues we receive from the worst ones. What’s the naive solution ? Iterate through all possible rectangles and calculate the area....

January 30, 2017 · Kshitij Banerjee

Reverse Engineer data from raw database files.

How to recover data from raw .tokudb files. Why? Recently my tokudb database went corrupt after a bad shutdown and a lot of data was now lost. After a lot of googling, asking on forums check here, here and panicking in general, I finally figured out how to get my data back after some Hard core. Brute force. Raw file Reverse-Engineering. How? Step 1 : Find your raw data files. The tokufiles have an extension of ....

Kshitij Banerjee