Skip to content

Instantly share code, notes, and snippets.

surajsaini95 /
Last active Aug 5, 2020
A blog on unsupervised ML algorithm


K-means is one of the most popular unsupervised learning techniques due to its simplicity and efficiency. It is an iterative and unsupervised clustering algorithm used in machine learning.

Quick Introduction

A cluster is a group of data points that are grouped together due to similarities in their features.The k-means clustering algorithm assigns data points to categories, or clusters, by finding the mean distance between data points. It then iterates through this technique in order to perform more accurate classifications over time.

enter image description here



The world is constantly being attracted towards containers and its orchestration especially in large and dynamic environments which has also led to the rising of various tools and platforms in trend.

As we all know that Docker is a major player in the world of containers and therefore in this blog, we will be exploring what it offers in terms of orchestration.

Yes, we will be looking at Docker-Swarm and some of its key components !!!

Also here I am assuming that the reader is prior aware of the basic docker concepts like container, image, etc.


Namespaces in Kubernetes

Being a container-orchestration system for automating application deployment, Kubernetes is adopted and highly practised by many teams while some prefer to explore it till depths.

So it becomes important for a cluster manager or a cluster admin to split numerous cluster components or objects or resources into smaller distinct groups. It enables smooth management and effective usage of isolated resources without overlapping.

What is a Namespace?

A namespace can be considered as a virtual cluster inside your Kubernetes cluster which are logically isolated from each other.

Each Kubernetes namespace provides a different scope which means that using the combination of an object name and a Namespace, each object gets an unique identity across the cluster.


Init Containers in Kubernetes

This is the era of containerization and orchestration where majority of the application are following the trend of running on a container which are further deployed in a Kubernetes cluster. It’s sometimes necessary to prepare the main container which will be running our application or the main logic.

There can also be situations where we need to execute a particular utilities or setup scripts that are not present in our main image ( as it would make it heavy and we only need it once in the beginning ).

What are Init Containers ?

Kubernetes provides special type of containers that runs to completion before the main app's container and Kubernetes will repeatedly restarts the Pod until the init container succeeds. Some of its properties are :


Persisting & Sharing Data in Docker

In this blog we will look at various ways in which storage from host machine can be mounted to containers. Also it can be seen as a way of communication in case the networking is disabled for your containers.

A quick intro

Docker is a popular containerization tool used for packaging, deploying, and running applications.

Containers are supposed to be light-weighted but by default all files created inside a container are stored on its writable-layer making it heavy to create and run.


Backup & Restoring Jenkins

The purpose of the backup is to create a copy of data that can be restored in the event of a primary data failure which can be the result of hardware or software failure, data corruption, or a human-caused event, or accidental deletion of data.

Backup copies allow data to be restored from an earlier point in time to help the business recover from an unplanned event.

Why Jenkins needs B & R ?

In Jenkins, all the settings, build logs and archives of the artifacts are stored under the JENKINS_HOME directory as Jenkins don't use any database . Setting access rights, selecting the necessary plugins and jobs configuration is quite a laborious process, so it’s a good idea to organize regular backups of all the necessary settings and parameters.


Going Declarative in Jenkins

Jenkins pipeline plugin version 2.5 introduces support for Declarative pipelines.

Declarative pipeline contains a predefined hierarchy to create Jenkins pipelines but it still uses the DSL steps as its base with a well-defined structure around the steps. It gives you the ability to control all aspects of a pipeline execution in a simple, straight-forward manner.

Declarative Pipeline is a more recent feature of Jenkins Pipeline which:

  • provides richer syntactical features over Scripted Pipeline syntax, and
surajsaini95 /
Last active Apr 10, 2020
this blog provides a brief guide on using variables in ansible

Ansible Variables

While automation makes it easier to do things which are repeatable but all systems are not exactly alike as some may require configuration that is slightly different from others.

For example, you might need to find out the IP address of a system and use it as a configuration value on another system.

Ansible uses variables to help deal with differences between systems.

surajsaini95 /
Created Apr 10, 2020
the blog provides an overview of using ad-hoc commands in ansible

Going Ad-Hoc With Ansible

Ansible came to the market as a Simple IT automation tool for server/infrastructure management. Being Simple, agentless, pythonic and many more features to count on it also supports ad-hoc commands.

The Ad-Hoc command is the one-liner ansible command that performs one task on one or more managed nodes. Ad-hoc commands are quick and easy, but they are not reusable.

Why use ad-hoc commands?

Ad-hoc commands are great for a very particular task or for the tasks you repeat rarely.For example doing SCP on server/machine in aws group.

surajsaini95 /
Created Apr 3, 2020
provides an overview on how ip-tables can be used in Linux to implement firewall.

Iptables in Linux Firewall


Managing network traffic is one of the toughest jobs a system administrators has to deal with. He must configure the firewall in such a way that it will meet the system and users requirements for both incoming and outgoing connections, without leaving the system vulnerable to attacks.

This is where iptables come in handy as they are Linux command line firewall that allows system administrators to manage incoming and outgoing traffic via set of configurable table rules.