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.

a =  [1,2,3]
for v in a:
print(v)

Below one shows explicit use of iterator.

a =  [1,2,3]
for v in iter(a):
print(v)

And without a for loop, things look…


Photo by David McBee from Pexels

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 features of HTTPS, SSL etc which all other websites have, but it didn’t take long when things started to break and had to be fixed before anything could be done further. In short there were multiple holes in my setup.

Now the question was how to make it free of any holes plus if I ever needed to setup again, do I need to go through all of this again? …


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 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:


This is the last part and we will cover how to create a basic Complex class which would behave like the builtin complex class. We will start by adding just constructor and destructor and then go ahead with implementing remaining magic methods.

Adding some OOPs

The built-in complex class is named complex with the small ‘c’. We will also name our class Complex but with the capital ‘C’.

For now we have only __init__ and __str__ methods. This allows us to create Complex objects and easy printing. Notice that the init has default arguments as well. …


The previous one covered usage of built-in complex class. It’s time to write our own code to handle complex numbers. This story focuses on creating and handling complex numbers using functions only. So the OO(Object Oriented Treatment) will come in the next part.

Before we get our hands dirty, lets see what all we will do.

  1. Represent complex numbers using a tuple.
  2. Write method to find conjugate and negate: Unary Operations
  3. Add and Subtract methods: Binary Operations
  4. Multiplication and Division

Complex number in a Tuple

We are going to put the real and imaginary part of a complex number into a tuple. So or representation…

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