Monte Carlo Method

In this essay I will talk about a term you might've come across when reading scientific literature or research papers. Idea is to develop gut feeling (intuition) for what the text is saying when Monte Carlo Method is mentioned.

Prerequisites

Monte Carlo Method (MCm) builds on top of other topics and concepts, taking time to understand them will make learning about MCm quite easy.

  1. Randomness in computers
  2. Law of Large Numbers
  3. System or Process Model
  4. Probability Distribution (Function)
  5. Deterministic Computation (Function)
  6. Markov Chain

Read more…

Link Preview & Open Graph Protocol

Notice how on posting a link on some sites or some messenger apps, a link preview shows up?

One might think the site/app crawls the webpage for this information but that's not the case. There is lot more interesting tech at play here.

Simply put

Open Graph Protocol

Let's take a deeper look and answer three questions

  1. What is Open Graph Protocol?
  2. How can I create custom link previews?
  3. Can I create dynamic link previews?

Read more…

Art of "Sit Down & Write"

Ever been afraid to start? Maybe to start writing or working out or drawing or painting. Ever been stuck because you have no idea where to begin? I know I have been there and hated it.

I published a technical book and when I met a friend afterwards, he asked me for my writing process - inspiration, rituals, how I kept myself going etc.

I tried not to be rude but best I could manage was to answer, "You sit down and write."

He was not pleased, to say the least, but that's the truth...

You sit down and write.

There is nothing new here. If you have ever read any book on creativity, you will have read this same message a million times and rolled your eyes. It's easy for you to say! You don't know how hard it is for me to muster the strength and put myself into it.

Unfortunately I think this is one of those basic truths that no one wants to hear nor acknowledge.

Read more…

Startup that broke me

My first job was at an IT Services company.

My title was Software Engineer but the work was stupid1 and management was even more stupid2. I vowed to never work at a BigCorp again.

I followed this up by working at startups but many of them failed and soon I became an expert at "This project/company is gonna die!".

At first I saw this as a curse but eventually I came to see this as a boon. If you can tell the future, you can avoid mental/emotional trauma3.

The Startup that broke me

I work at a BigCorp now4 and all credit goes to the last startup I worked at.

Let's unpack...

Read more…

My Frontend Adventure (2021)

What is the best way to get started with Frontend development in 2021?

Every time I start looking at the current state of Frontend tools it starts to freak me out.

The start

I decided to bite the bullet and VueJS felt alluring.

$ npx create-vue-app

Lo & Behold! I have an app with has around 100+ vulnerabilities.

I try to update and --force update the deps and I still have 70 vulnerabilities left.

I will be honest with you, it does not feel good to create a fresh app with so many issues preinstalled.

What did I do next?

Read more…

Productivity for the Overwhelmed & the Anxious

Productivity for the Overwhelmed & the Anxious

A few years back I was suffering from terrible anxiety which basically made it impossible for me to get anything done.

It was a mix between

  • Fear of wasting time on wrong thing
  • Fear of prioritizing incorrectly
  • Fear of forgetting important tasks
  • the list goes on...

Many of these were valid concerns and while I knew about a few task management systems (GTD, Pomodoro, etc) they had some strict rules (and for good reasons) but not useful when suffering from anxiety and indecision. I had to come up with a system that would work while taking my anxiety into account.

Few things the system had to do:

  1. Let me categorize tasks in order of importance/significance.
  2. Be flexible in case of wrong categorization.
  3. Create a sense of progression.
  4. Let me add new tasks when they pop in my mind during the day.
  5. Create certainty around time spent on each task.

Read more…

FP for Sceptics: Intuitive guide to map/flatmap

Backbone of Functional Programming

map & flatmap form the backbone of Functional Progamming. It is very important be comfortable with these two concepts and this guide will help you develop an intuition for them.

This guide is language agnostic but I expect you to be familiar with basic programming concepts like functions, types, data type/objects and list.

Nomenclature

Let me introduce you to some basic terms we will be using to talk about map/flatmap.

  • Types are data constructs and they can be Basic Types like Int, String etc.
  • Container is a special type which contains another type. For example a List of Ints.
  • Function is a function whose input is of Type 1 and output is of Type 2. Type 1 & Type 2 can be same type.

Visualize

Though I have defined three terms it will be easier to think about them visually.

Basic types (Int, String etc) will be represented by shapes

Basic Types.

Read more…

My Favourite Evening Snack

I know what you are thinking

I thought this was a programming blog, wtc is this? But hear me out!

Few weeks ago I saw a video by Matt D'Avella where he was talking a quick healthy snack and the part showed him putting a few dried corn kernels into a small vessel and after a few minutes, popcorn ready.

That intrigued me, to say the least.

I gave it a try and Yes, it's that simple.

Popcorn I made

A few things to keep in mind of course, so read on if it interests you.

Salted Popcorn

  1. Take a small iron pot. (Preferably with thich bottom)
  2. Add in some oil. (I used Olive Oil)
  3. Drop the kernels into the oil.
  4. Partially cover it with a lid.
  5. Wait for em to pop!
  6. Add in a bit salt (not too much!) and shake em around.

Movie Popcorn

Do you yearn for the popcorn we get at movies without the unhealthy side of it? Yes, you can make it at home.

  1. Take a small iron pot. (Preferably with thich bottom)
  2. Add in clarified butter. (Not normal butter) 3-6. Same as before.

Things to know

Why to partially cover the lid?

The kernels have some amount of moisture in them. By partially opening the lid, you let the water vapour out getting them crunchy.

Also the reason the kernels pop is because the moisture inside the kernels get super heated and need to vent out.

Why not normal butter?

If you heat normal butter for long, it starts burning. This is because of milk residue in the butter.

Also it has moisture in it causing popcorn to get soggy.

Don't use too much Oil!

If you add in too much oil, there is a chance the popcorn will get soggy (that was my experience).

Also the popcorn will smell & taste lot more of the oil used. While I love me some Olive Oil, too much on my popcorn feels weird.

Variation on Cooking Style

One variation I read online is to wait until the oil heats up sufficiently before putting in the kernels.

How do you know when the oil is ready? Put in a kernel or two at the start and wait for both of them to pop before you put in the rest.

Conclusion

So there you have it folks!

That's how I am now addicted to my evening popcorn.

Ent's snappy guide to Emacs

Introduction

I have used many editors over time and one "System" that I really enjoyed was Emacs. However I did not understand how it worked under the hood and it led to some fun times. This post is an attempt to log my experience with learning and understanding the "missing bits" in a single place.

This guide is consolidation of knowledge & experience of 2-3 days of intense focus learning & modifying Emacs.

Purpose

The aim of this guide is to quickly:

  • Bootstrap your understanding to a level where you can start thinking in terms Emacs' terminology and use that knowledge to searching the internet for new questions you might have.
  • Develop a rudimentary understanding of how to customize Emacs.
  • Setup an aesthically pleasing UI with usable setup.

This guide IS NOT about the basics of text editors like:

  • What are text editors? What is Emacs or Vim?
  • Which editor should I use?
  • How to navigate using either editor?
  • How to read/write elisp. I have a basic understanding of lisp/clojure but otherwise I haven't bothered with learning it for this.

Read more…

Second Static Website

Static Website Hosting

I really like the low footprint and utility of Static Websites. This website is built using Nikola.

In this post I will talk about some issues I faced with deploying a second static website and how I eventually solved it.

Github Pages

I have long enjoyed the awesomeness of User Github Pages and am quite happy with it.

However as soon as I tried to create a second independent static website with custom domain, Github was having nothing of it.

After spending lot of time scouring the web for how to make it work between Github & Namecheap, my DNS provider, I had nothing to show for it.

Read more…