Photo by Obi Onyeador on Unsplash

I was working on a project and I wanted something to do the these things for me:

  1. Execute a bunch of statements (a function).
  2. from multiple go routines.
  3. only once.
  4. and at least once before the parent go routine exits.

Consider a simple function like below, which can be called from multiple locations, but the code has to get executed exactly 1️⃣ time.

My first thought was channels. Create a channel, run the task in a goroutine and let the task wait till someone adds a value to the channel. …


Image of a guy wearing a white t-shirt, holding cash in his hands, spread out like playing cards, with an expression of happiness.
Image of a guy wearing a white t-shirt, holding cash in his hands, spread out like playing cards, with an expression of happiness.
Photo by REX WAY on Unsplash

Go to bank and withdraw your complete salary in cash, said my friend. Bring it home and look at how much you have earned. Feel it, look at it, enjoy it.

Since then, I have made it a ritual for myself. Whenever I get a pay raise, I go to the Bank, withdraw the entire salary (rounded off to hundreds), bring it home and… and I’ve added a small thing to what they told me.

My friend is my guide, my mentor and many other things. I have learnt many things from him.

He is a great story teller and observer. He tells stories of his friends, friends of friends, friends of friends of friends. I have listened to many stories of his friends, friends of friends and so on. But…


i’m a software developer.. not an athlete

i should start going to gym.
why do i need to workout so hard.. cos it’ll keep me fit and healthy.
but who said that.

don’t know. everyone’s doing.. i should do. (oh! then you should)
i’ll go to gym from next week. that’s my b’day resolution.

but what about protein.. don’t you need protein.
yeah.. otherwise i’ll die. i’ll find some foods high on protein online.. or the trainer will tell me some good diet.

i’ll buy some protein supplement and take it after workout.. my favorite chocolate flavor.

oh.. forgot the workout playlist.. i definitely need some good…


Images can’t replace code

Iterators is the one thing that makes looping or iteration so easy and beautiful in python. Many of us use it all the time without noticing where and how it’s working.

Simple usage of iterators involves using a for loop to run through the elements of an iterable like a list, dictionary or any kind of type that supports iteration. Mostly you write something like this.

Below one shows explicit use of iterator.

And without a for loop, things look…


Photo by David McBee from Pexels

Caution ⚠
before reading all this if you are not aware, go and look for static site generators and free static site hosting options like github pages, firebase etc. Maybe a simple thing like that is just what you need.

When I started out building my own website with wordpress, I struggled a lot! Somehow I managed to get a website up and running with HTTPS, SSL etc. Things all websites have. But it didn’t take long when things started to break and had to be fixed before anything could be done further. …


Before we start setup part let me tell you about the things that made me struggle the most:

  • HTTP to HTTPS redirection
  • Installing SSL Certificate: So that browser doesn’t block your website
  • Apache vs Nginx: Which web server to use
  • Lots of commands: And they need to be in some order

One solution to all of the above problems was Docker. What we can do is use pre-built docker images where we just need to set some values and the job is done. It’s better if you read about docker and try to understand it. …


Cloudflare is one of the many DNS providers. They provide different kind of plans, of which we will obviously go for the free one 😉.

This part is not useful if you are not planning to buy and/or link any domain with your website. For testing purpose you can access it via IP Address as well.

First thing we need is a Cloudflare Account. So go here and sign-up for one. Other wise login to your account. After signing-up make sure you verify your email. Further steps will be quite important so make sure you don’t miss anything.

Now login…


GCP is Google Cloud Platform; an offering from Google. It’s like AWS (Amazon Web Services) if you know of AWS. Why we are using GCP? It’s just that I picked it first and doesn’t require billing enabled in the beginning unlike AWS. Though AWS also offers free things.

Now login to your google account then go to GCP page or directly go to below link and login there if not already logged in.

GCP offers free trial credit of $300 for an year when you enable it for the first time. You will not be charged for anything for one…


There will always be controversies around both: kissing and shitting. And depending on the social background etc. people will have wildly varying opinions about each. For some it may feel what is even the need to write something about kissing in open and for some it might be something they would disgust.

This isn’t much about kissing your partner in open, it’s more on shitting.

Note: some of the things that I write are for purpose of sarcasm.

The three words highlighted there: shitting, open, kissing
are the things we are going to think of here. And their relevance in…


Sorting if you have ever used in Python is as simple as

something.sort()

or

sorted(something)

Lets explore in depth.

Photo by Soraya Irving on Unsplash

Warning: A lot of code coming in. All code snippets are images.
Please type code yourself. For reference a git link to the complete notebook is here.

Sorting a list of numbers looks as simple as this:

leangaurav

Developer, Trainer and Fitness & Yoga Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store