As originally stated, Panic is a built-in function that stops the ordinary flow of control and begins panicking. When the function F calls panic, execution of F stops, any deferred functions in F are executed normally, and then F returns to its caller. To the caller, F then behaves like a call to panic. The process continues up the stack until all functions in the current goroutine have returned, at which point the program crashes. Panics can be initiated by invoking panic directly. They can also be caused by runtime errors, such as out-of-bounds array accesses.
In simple terms, a…
Many of us have to feed our applications with many variables, including general settings like timeout intervals, database host URL, passwords, and more. And most of us won't accept 🤐, but we have these embedded in our codes.
Mostly not, but when it does it's too big to handle sometimes. Let's see what these can be -
A week ago, I was stuck with a problem that included dealing with a Load Balancer. And like most of us using cloud services, a load balancer was just a managed resource for me that simply takes the incoming traffic to the desired servers.
But that day I realized that the amount I know about Load Balancers isn’t enough to work on them or properly understand them. So, I spent some time around learning them, and here is what I could find.
Load balancing refers to efficiently distributing incoming network traffic across a group of backend servers.
And a Load…
In today’s world of cloud computing, Terraform has gained a special place among the top infrastructure provisioning tools. I have been using it for quite some time and have carved out some good practices around it.
Let’s take a look on some factors that contribute on writing a good terraform module.
As said by Hashicorp itself,
In principle any combination of resources and other constructs can be factored out into a module, but over-using modules can make your overall Terraform configuration harder to understand and maintain, so we recommend moderation.
A good module should raise the level of abstraction by…
In a usual scenario you actually scale your systems to handle the amount of requests that you already predicted. For a system that is capable of handling 100 requests at a time, the expected traffic is not more than 80 concurrent requests. And a buffer of 20 requests is kept in order to sustain a sudden spike.
But what if, a spike of 30 requests came in. Will the system be able to handle these many requests ?
The answer is NO. Above scenario will result in a completely totalled system that also dropped the already processing requests.
While using Airflow, one of the biggest hurdle is to fetch the task logs . Below given code allows to fetch logs from airflow by providing — airflow address, dag id, task id, execution date and try number.
Note: This works only when the executor type is CeleryExecutor
Note: if you are providing url encoded time to the class then, at line 12, change
self.execution_date = urllib.parse.quote(execution_date)
self.execution_date = execution_date
There is a common use case where people need an editor that can use a certain key to encrypt their files while saving and while editing it can display the encrypted file in plain text.
Although vim has certain extensions to accomplish this but those make this process a bit too complicated.
So here we will use our basic terminal editor vim and layer it up with our code to make it satisfy our use case while still keeping the approach simple.
Step1: Writing/Editing a file
$ goCrypt -w /path/to/file -k encryptionKey
this opens up vim and allows you to…
A weighted graph is a graph in which each branch is given a numerical weight. Therefore it is a special type of labeled graph in which the labels are numbers (which are usually taken to be positive).
Maps with weights representing distances.
Water networks with weights representing water capacity of pipes.
Electrical circuits with weights representing resistance or maximum voltage or maximum current.
Computer or phone networks with weights representing length of wires between nodes.
One of the canonical applications for weighted graphs is finding the shortest path between two nodes. These algorithms are used in Google Maps for example.