Posts

Why we can relate to Saitama

Image
Superman is awesome. He never stops being awesome. Even when he sleeps he's bulletproof, the dude has no layups, no cheat days, and the few times he's "just Clark Kent" he's still stealing hearts of lady friends and charming everyone off their feet. And it's not just about superpowers that make these superheroes what they are. Even Batman is deep dark and mysterious twenty four seven three sixty five, whether in regalia or business suit, whether in batmobile or private jet. How long have you ever been awesome, and stayed awesome? School/college sports stars, valedictorians, or on-the-job outperformers have had the longest stints at awesomeness, lasting anywhere from months to years. But how many of us mortals have reached and sustained such peak performances? 1%? The remaining 99% of us are One Punch Men. We have our moments of brilliance, maybe an hour (or maybe just a Warholian 15 minutes) in a year when we feel like the gods dwell in our fists. ...

Why B̶l̶o̶g̶ Write?

Was reading Sharma Radhakrishna Venkataramanan's blog and in one entry he asks "why Blog?" His answer is that "writing is a window to the workings of a person's mind," drawing on a few anecdotes. One of the anecdotes is about rediscovering something about his grandfather that his 7 year old self could never have. This threw me on a tangent and I pieced together something my Cousins' Grandfather told me. (As a child he had run away from his village home in pre-independence India, lived on the footpaths of Lucknow while attending school, and -- to cut a long story short -- ended up a professor of literature at Kanpur University. We all looked up to him.) Only times when I met him would be if our visits to that Aunt's home coincided. For a short period the frequency was enough to allow one routine: he would give me one life lesson or instruction. One, and no more. Of these, there's one that stands out and hasn't faded with memory. He said: Writ...

When Zipline Gets Stuck

Image
I stumbled across this Analytics Vidhya article by Sabir Jana How to Import Indian equities Data to zipline on your local machine? and after more than 2 years I was tempted to give it a shot once again. Jana's post specifically addressed the roadblock that prevented most Indians from using the library. Zipline, after all, is the retail industry standard when it comes to backtesting in Python. Entire books are devoted to it, and all other backtesters are considered a distant second. Jana's article is well written, and code is not just easy to follow, it's very well written. (There is a problem with tabs in the medium post, and indentation isn't clear because of the font used, so I used this version instead.) However as soon as I was done fetching BSE data from Quandl and ready to feed it to Zipline, I ran into a new hurdle: Zipline just absolutely refused to install! The error message overflowed the terminal's buffer and I had to route the output to a log file, on...

Lenovo IdeaPad 320 15AST Battery issue

Image
It started out as a small kink: the palm rest to the left of the trackpad swelled up a little. I knew that it was a battery issue. I opened the back cover, visually verified my hunch but it looked benign, and I had used swollen Li-Po cells in drones which work fine until they stopped charging. And the laptop was working fine so I ignored it. But it got worse very gradually and I did not realize it until the plastic cracked. It looked gnarly, but there was no issue with any functional aspect of the computer. Opened the back cover and noted the battery part number: L16C2PB1. Searched for the part number on Amazon and Flipkart, but it was out of stock everywhere. The laptop was still fully functional so I ignored it again. And one fine day I started the machine and half the keyboard wasn't responding. Opened the machine again, only to discover that keyboards aren't built like they used to be, there are no copper contact pads, and the rest of the motherboard is mounted in a way tha...

Notes on Google Authentication with Flask

There are many ways to set up Google Authentication with Flask. I found 3 self-contained guides using completely different methods, and I played with all 3 to find their strong points and problems. This blog documents those observations: 1. Create a Flask Application With Google Login Why you should try this: good explanations that help you understand the OAuth workflow part of Real Python's larger Flask tutorial. Although I did not use it, it might be good to see how it fits into the larger framework uses [flask-login](https://github.com/maxcountryman/flask-login) module which counts Flask personalities like David Baumgold and Miguel Grinberg as contributors, so current implementation as well as future developments are/will be tightly integrated with the Flask framework Why you might not end up using this implementation: simpler ...

Notes on Flask

Flask with AJAX For those well versed with Flask and AJAX this is nothing new, but for newcomers to both/either, the following code snippet is a quick start introduction to using AJAX with Flask on their websites. Python Flask + JavaScript XMLHttpRequest. There are a large number of tutorials and examples out there, but this one helped me the most because of its simplicity. It uses plain JavaScript instead of JQuery or any other framework, and given my incremental style of development, and "Mistake Driven Learning" style of learning, this was my starting point for the MarketDB project. Eschewing JSON In the current stage, I am avoiding using JSON as much as possible for three conscious reasons: (1) less learning required to handle JSON in JavaScript and Python. I know this is just laziness, and I already do know the basics of JSON in both languages, but using it in a production project requires deeper dive into the standards, which is really not necessary. Lists suffice for ...

Theme-ing Lektor

Documented steps for changing theme: https://www.getlektor.com/docs/themes/installing/ So first I create a local directory in project root to hold all Lektor themes mkdir themes then I cloned a theme into that folder git clone https://github.com/Andrew-Shay/lektor-theme-simple-strap.git themes then I added a reference to that theme in the project config file: nano nitishshukla.com.lektorproject themes = lektor-theme-simple-strap #Ctrl+o, Enter, Ctrl+x, Enter now update repo git add . git commit git push origin master By this time there was already an error in Netlify: 12:51:55 AM: Error checking out submodules: fatal: No url found for submodule path 'themes' in .gitmodules 12:51:55 AM: Failing build: Failed to prepare repo 12:51:55 AM: Failed during stage 'preparing repo': Error checking out submodules: fatal: No url found for submodule path 'themes' in .gitmodules : exit status 128 This basically means that the theme that I cloned into [project]/...