Skip to content

Instantly share code, notes, and snippets.

View susovanpanja's full-sized avatar

Susovan Panja susovanpanja

  • Mohali
View GitHub Profile
@susovanpanja
susovanpanja / Jenkinsfile_Active_Choice_Reactive_Parameter
Created January 4, 2024 14:53
Example of jenkins code for Active Choice Reactive Parameter
properties([
parameters([
choice(choices: ['Development','QA'], description: 'Select Deployment Environment', name: 'DEPLOYMENT_ENVIRONMENT'),
choice(choices: ['release','snapshot'], description: 'Select Nexus Repo', name: 'NEXUS_REPO'),
[$class: 'CascadeChoiceParameter',
choiceType: 'PT_SINGLE_SELECT',
filterLength: 1,
filterable: false,
name: 'ARTIFACT_VERSION',
randomName: 'choice-parameter-7777777777777777',
@susovanpanja
susovanpanja / git_commands.txt
Created December 29, 2023 08:15
git cli command to rename a existing remote branch
# We want to rename an existing branch on remote repo to a new one using cli
# Optional if we already have the branch on local system
$ git checkout OLD_BRANCH_NAME
# switch to any branch other than the branch that need to be renamed
$ git checkout master
$ git branch -m OLD_BRANCH_NAME NEW_BRANCH_NAME
@susovanpanja
susovanpanja / Makefile
Created May 25, 2023 14:31 — forked from ninjatux/Makefile
Makefile bootstrap
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@susovanpanja
susovanpanja / repository_cleaner.sh
Created February 24, 2023 11:13
Remote Container Repository cleanu using skopeo
#!/bin/bash
read -p "Enter the container repository url with port number e.g 10.10.10.10:32000 => " repo_url
repo=( $(curl http://$repo_url/v2/_catalog | jq -r .repositories[]) )
for r in ${repo[@]}; do
tags=( $(skopeo list-tags --tls-verify=false docker://$repo_url/$r | jq -r .Tags[]) )
for t in ${tags[@]}; do
skopeo delete --tls-verify=false docker://$repo_url/$r:$t
#### This script is written to update your kubeconfig file for eks. It will first get sts token for the role, that is mapped
#### with EKS cluster kubernetes using aws_auth config map. And then update your kubeconfig file for the cluster.
#### Replace role-arn with the role that is mapped with EKS cluster kubernetes using aws_auth config map.
#### Ref: https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html
#!/bin/bash
echo $(whoami)
@susovanpanja
susovanpanja / resignation.txt
Created June 28, 2021 16:16 — forked from QuinnyPig/resignation.txt
Templated resignation letter
Dear BOSS,
Please accept this letter as formal notification that I am resigning from my position as JOB TITLE with COMPANY. My last day will be DATE OF LAST DAY.
Thank you so much for the opportunity to work in this position for the past DURATION. I’ve greatly enjoyed and appreciated the opportunities I’ve had to WTF DID YOU DO, and I’ve learned many things, all of which I will take with me throughout my career.
During my last two weeks, I’ll do everything possible to wrap up my duties and train other team members. Please let me know if there’s anything else I can do to aid during the transition.
I wish COMPANY continued success, and I hope to stay in touch in the future.
Sincerely,
@susovanpanja
susovanpanja / refresh-certs.sh
Created May 27, 2020 09:05 — forked from ktsakalozos/refresh-certs.sh
Refresh MicroK8s Certs
#!/bin/bash
set -eu
export SNAP_NAME="microk8s"
export SNAP_DATA="/var/snap/microk8s/current/"
export SNAP="/snap/microk8s/current/"
export PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH"
source $SNAP/actions/common/utils.sh
@susovanpanja
susovanpanja / aws_cli_mfa_token.sh
Created September 18, 2019 15:55
MFA token to authenticate for AWS CLI
### What we are trying to achieve is this: (https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/) with automatic script ###
### Remember you need to install aws-cli and use aws configure to add the credentails, to run aws commands ###
### Also assuming you have enabled MFA on aws console and know how to generate MFA code using Authy/Google Authenticator/ etc.
#!/bin/bash -xe
# Getting temporary credentails from aws using MFA token from authy or google authenticator
ARN=arn:aws:iam::{Account ID}:mfa/{UserName}
# checking for aws path
@susovanpanja
susovanpanja / clean_old_lambda_versions.py
Created June 28, 2019 10:45 — forked from tobywf/clean_old_lambda_versions.py
A quick script to remove old AWS Lambda function versions
from __future__ import absolute_import, print_function, unicode_literals
import boto3
def clean_old_lambda_versions():
client = boto3.client('lambda')
functions = client.list_functions()['Functions']
for function in functions:
versions = client.list_versions_by_function(FunctionName=function['FunctionArn'])['Versions']
for version in versions:
@susovanpanja
susovanpanja / mongodb-s3-backup.sh
Created February 11, 2019 12:26 — forked from eladnava/mongodb-s3-backup.sh
Automatically backup a MongoDB database to S3 using mongodump, tar, and awscli (Ubuntu 14.04 LTS)
#!/bin/sh
# Make sure to:
# 1) Name this file `backup.sh` and place it in /home/ubuntu
# 2) Run sudo apt-get install awscli to install the AWSCLI
# 3) Run aws configure (enter s3-authorized IAM user and specify region)
# 4) Fill in DB host + name
# 5) Create S3 bucket for the backups and fill it in below (set a lifecycle rule to expire files older than X days in the bucket)
# 6) Run chmod +x backup.sh
# 7) Test it out via ./backup.sh