Alias Creation in Windows Using Python

One thing I’ve missed in Windows post my switch from Linux is the ability to create aliases for commands. In Linux, you can create an alias for a command by adding the following line to your .bashrc or .bash_profile file - alias ll='ls -l' This would allow you to use ll instead of ls -l in your terminal. In Windows, you can create a similar alias by creating a batch file and adding it to your PATH environment variable. ...

February 17, 2025 · 2 min · Abhiram R

Focus mode - A "kutty" chrome extension

By now you’ve seen a lot of stuff being built using ChatGPT. A lot, Jerry. A LOT. I’ve built a few apps and extensions as well, but this is the first I’m writing about. Over the last 3-4 years, “building” software on any scale has seen quite a radical shift. Here’s an image to scale - So when I first tried to build a Chrome extension for a company hackathon in 2022, I took around 12 hours, pulling an all-nighter. I looked up documentation, Stack Overflow answers, sample blogs and trudged through the whole process - The way god intended it. And finally completed…something. The end result was something that did the job I wanted but it looked absolutely horrendous and I had to hand-wave over the UX because I had no time before the presentation. ...

January 29, 2025 · 4 min · Abhiram R

Timeline charts

I’m not feeling all too well but I didn’t want to break my streak of writing. So today I’m writing about a non-Python related topic - Timeline Charts. I was doing a profiling activity for work and I was scratching my head for a way to represent the info so as to explain it easily. Then I got to thinking, how does Google build all those charts to track page loads and API runtimes in Developer tools? ...

November 20, 2024 · 2 min · Abhiram R

Dataclasses

19th Nov 2024 I was trying to write an article on Dataclasses1 and I looked up an example on the official website2 Easy enough on the face of it, but it led me into quite a rabbit hole. A dataclass allows for the creation of “special methods” for a class when the annotation @dataclass is sighted. So if I have a class “Superhero” with the annotation : @dataclass class Superhero: """ A class of superheroes and properties about their appearance in Marvel movies """ name: str superpower: str appearances: int = 0 def beckon(self): print(f"{self.name} with the super power - {self.superpower} has appeared in Marvel movies {self.appearances} times") superhero = Superhero("Aquaman","Underwater breathing",2) superhero.beckon() It effectively means that : ...

November 19, 2024 · 3 min · Abhiram R

Making your first blog with mkdocs

Now, why do this? What’s wrong with Medium and Substack and Blogger and Wordpress and all the tens of websites out there? Nothing. You could totally just create a blog there and publish. That’s why Content Management Systems exist - so you could focus on the content and not on the management . But if you’re like me and want some more control over how you publish your blogs, customize them etc. , you will find this and the other upcoming articles in this category interesting. ...

November 16, 2024 · 4 min · Abhiram R

LC Num 21

21. Merge Two Sorted Lists First I didn’t understand the problem I think. In the sense that I accepted the inputs as two lists and returned a list - Python list. Then I read it and realized they want the operation in Linked lists. i took some time to recall how to move along a list and finally figured it out. The other thing that gave me a minor ankle break was when the test case was two empty lists. ...

April 15, 2024 · 2 min · Abhiram R

Enabling Spark History Server Standalone

I’ve been using Spark for close to 2 years now but because I’ve always used it largely on clusters at work, I’ve never really had to struggle with the minutae of enabling monitoring pages like the Spark History Server UI etc. Now that I’m exploring some advanced concepts in Spark, one of the first things I learnt was enabling the Spark History Server locally i.e on a Standalone installation. Let’s assume that our Spark installation’s version is 2.3.2 and we’ve extracted the binary into /opt/spark-2.3.2-bin-hadoop2.7. ...

December 27, 2021 · 2 min · Abhiram R

Learning how to use FFMpeg

What is FFmpeg? In their own words, FFmpeg is “A complete, cross-platform solution to record, convert and stream audio and video.” I’ve been recording Bangpypers videos for the last few months and I haven’t really had access to a proper solution to edit videos and audio that I could have got for free/ low-cost. A good friend of mine, Vinay Keerthi, (who incidentally presented the webinar under discussion) told me to chuck GUI based fronts for editing them and told me to try FFmpeg, the CLI tool directly, which these tools probably use in the background anyway. ...

December 6, 2020 · 4 min · Abhiram R

Custom CSS Jupyterlab Ext

Jupyterlab is a definite improvement on the older IPython notebook interface - both in features and in appearance. There is now even an in-built “Dark Theme” that can be enabled. But is that all? As we know, Jupyterlab is a browser based app and is ipso facto, written on a base of HTML, CSS and Javascript. So if we want to change the appearance over and above what we get out of the box with jupyterlab, we can. Now, it is possible to make any CSS changes by hacking into the internals of the notebook, but thanks to a nifty Jupyterlab extension by Adam Wallner, we don’t have to. ...

December 10, 2019 · 3 min · Abhiram R

Setting Up Python3.8 and Jupyterlab

I’m using Ubuntu 16.04 on this machine, so that’s what the steps of installation here will be for. But this installation shouldn’t largely vary on any distro that’s 14.04 and higher. Step 1 - Download Python source code Binary installations are available for Windows and Mac but you can either install Python3.8 on Ubuntu using “apt” or download and install from source. I did the latter. Obtain the gz file from here. ...

November 7, 2019 · 2 min · Abhiram R

Git Jupyterlab Ext

Disclaimer : Extensions in Jupyter-lab are still very much experimental. But this one seems to be working fabulously so far. jupyterlab-git is an extension that lets you stage and commit changes to notebooks made right from within the Jupyterlab interface. This is best installed within the confines of a virtual environment, as is anything experimental. Installation steps - a) Ensure that you have the latest version of jupyterlab (=1.2.0 at the time of this writing) and NodeJS(=12.13.0 at this time) ...

October 31, 2019 · 1 min · Abhiram R

Pandas Notes

These are the commands I use a lot using Pandas - Get rows with NaNs in any column df[df.isna().any(axis=1)] Get dataframe excluding all NaNs in a particular Column df[df['<col_name>'].notnull()] Get counts of number of Nulls per column df.isnull().sum() Increase width of columns displayed in Jupyter Notebooks - This is possibly one of my most used commands for every notebook that involves dataframes. pd.set_option('display.max_colwidth',400)

August 23, 2019 · 1 min · Abhiram R

Podcasts I like

My current regulars Mythology by Parcast Rationally speaking with Julia Galef The Tim Ferriss Show Naval Ravikant Data Stories On Being with Krista Tippett The Python Podcast.__init Akimbo: A Podcast from Seth Godin Outliers Fall of Civilizations My favorite episodes Literary Is the catholic church a force for good - An Intelligence Squared Debate - With Stephen Fry and Christopher Hitchens What makes us human? - with Stephen Fry The Four Horsemen - Richard Dawkins, Daniel Dennet, Christopher Hitchens and Sam Harris The Tim Ferriss Show - with Neil Gaiman Neil Gaiman: How Stories Last Stephen Fry on PG Wodehouse Economics, Psychology, Marketing The Psychology of Advertising with Rory Sutherland Dan Ariely | Payoff Rationally Speaking #178 - Tim Urban on “Trying to live On Data Data Stories : Color with Karen Schloss FlowingData with Nathan Yau Python Podcasts The Real Python Podcast Talk Python To Me Python Bytes Test and Code From Python Import Podcast podcast.init Podcasts by Friends Tales of Time Travel by Gautham Shenoy Kannada Science Fiction by Gautham Shenoy The Forgotten Heritage of the Deccan by Karthik Malli People’s Choice Simblified The Pragati Podcast Paperback The Seen and the Unseen Echoes of India Via Nishant Singh ...

July 8, 2019 · 2 min · Abhiram R

Bangpypers PreWorkshop Setup

A guide to installing a newer version of Python is available here. We at Bangpypers conduct a lot of workshops and some steps are common for all of them. To that end, this post is meant to serve as guide for people to install Python on Ubuntu and Windows (if required), setting up virtualenv and installing the package(s) germane to the corresponding Workshop. Ubuntu Check your existing version of Python to see if you already have what’s required. ...

February 22, 2019 · 2 min · Abhiram R

F U Python Commands

The previous post was for commands Unix. This post is about the Python commands I use or Google frequently. To find the absolute path of the directory of the current file being executed - abs_path = os.path.dirname(os.path.realpath(file)) To copy a file from source to destination (using shutil)- from shutil import copyfile copyfile(src, dst) To copy a file or directory from source to destination (using shutil)- from shutil import copy copy(src, dst) ...

January 9, 2019 · 1 min · Abhiram R

Django Filter To Shorten Naturaltime

This is a filter snippet to shorten the natural time value obtained using naturaltime function from humanize. #In templatetag file , say file_tags.py from django import template register = template.Library() @register.filter def shorten_naturaltime(naturaltime): naturaltime = naturaltime.replace(‘minutes’,’m’).replace(‘hours’,‘h’).replace(‘days’,’d’) naturaltime = naturaltime.replace(‘months’,‘mon’).replace(‘weeks’,‘w’).replace(‘week’,‘w’) return naturaltime #In Usage file {% load file_tags %} {{start_time|naturaltime|shorten_naturaltime}} #where start_time is the datetime object to be modified {% if page.comments %} Please enable JavaScript to view the comments powered by Disqus. ...

June 26, 2018 · 1 min · Abhiram R

Memory Monitor Widget Using Python

I use Ubuntu 16.04 and I’ve been searching for a good memory monitoring desktop widget to no avail. I found a couple of taskbar widgets but none that would tell me the free memory left in addition to the used/swap/cache memories. So I decided to write my own (with loads of help from the Internet of course). Component 1 — The widget I didn’t know how to do this. Thankfully Stuart Langridge had already done this for me. I tweaked the override_background_color parameter to get a red background for my widget and the size of the widget itself to be 400*20 so it would be a nice small strip rather than a big blob of a rectangle. ...

June 5, 2018 · 2 min · Abhiram R

Studying The Show About Nothing

I have watched and re-watched Seinfeld over and over for the last 6–7 years now and it remains, till date, one of my most favorite shows. For a show that claims to be about nothing, it has certainly managed to fill up nine seasons worth of content, all with seemingly no plot. The show, if you’re unfamiliar with it, traces the day-to-day lives of (mainly) 4 quite unremarkable people — Jerry Seinfeld, George Costanza, Cosmo Kramer and Elaine Benes. These 4, along with plenty of other side characters and guest stars engage in what seems to be a series of meaningless conversations and activities, which somehow all come together towards the end of the duration of each episode. ...

February 12, 2018 · 6 min · Abhiram R

Data Visualization Exp2

Alright. Round 2 . FIGHT! So, the last time, I figured out, unintentionally, at what times of the day most of my posts happened. This time, I again unintentionally got results different from what I set out to do — I’ll get to this eventually I guess, but for now, the objective is obtaining a measure of the number of posts I make per day and thereby see if I can figure out which days of the week have been the most (least?) productive. Of course, this is still a step away from my eventual goal (hopefully Experiment 3 should sort it out). Let’s get to the methodology — ...

November 27, 2017 · 8 min · Abhiram R

Data Visualization Exp1

Hours of max FB Usage — I originally intended to do something else, but ended up doing this instead — Figuring out at what hours during the day I’ve been most active on Facebook — outliers included. How? Downloaded my entire Facebook data - This can be done using the Facebook APIs or using the less painful way — requesting for a copy of your Facebook data as a zip file from your Settings panel. ...

September 27, 2017 · 3 min · Abhiram R