Skip to content

Instantly share code, notes, and snippets.

View nitinsatish's full-sized avatar
🎯
Focusing

Nitin nitinsatish

🎯
Focusing
View GitHub Profile
@nitinsatish
nitinsatish / instance_filtering.md
Created November 2, 2022 11:50 — forked from sahilsk/instance_filtering.md
boto3, python, aws, instance filtering

Source

Russell Ballestrini

– Filtering AWS resources with Boto3

This post will be updated frequently when as I learn more about how to filter AWS resources using Boto3 library.

Filtering VPCs by tags

@nitinsatish
nitinsatish / k8s_shell.md
Last active January 4, 2023 10:24
[k8s container with interactive shell] #kubernetes #k8s

Ubuntu

kubectl run my-shell --rm -it --restart=Never --image ubuntu -- bash

Netshoot

kubectl run tmp-shell --rm -it --image nicolaka/netshoot

@nitinsatish
nitinsatish / delete_ns.sh
Created August 9, 2022 11:50
[Delete terminating namespace] #k8s
#!/usr/bin/env bash
function delete_namespace () {
echo "Deleting namespace $1"
kubectl get namespace $1 -o json > tmp.json
sed -i 's/"kubernetes"//g' tmp.json
kubectl replace --raw "/api/v1/namespaces/$1/finalize" -f ./tmp.json
rm ./tmp.json
}
@nitinsatish
nitinsatish / colors.sh
Created August 2, 2022 11:54
[shell colors] #shell #colors
# Reset
Color_Off='\033[0m' # Text Reset
# Regular Colors
Black='\033[0;30m' # Black
Red='\033[0;31m' # Red
Green='\033[0;32m' # Green
Yellow='\033[0;33m' # Yellow
Blue='\033[0;34m' # Blue
Purple='\033[0;35m' # Purple
@nitinsatish
nitinsatish / jd_deploy.md
Last active May 10, 2022 06:42
[jdeployer new image deployment] #juniper
  1. If jdeployer needs to be built. This happens when we want to incorporate new JD code.
cd Repos/atom/jdeployerSaaS
./jdeployer_image_builder.sh
  1. Tag this new JD image
docker tag jdeployer:220422 svl-artifactory.juniper.net/atom-docker/atom-of/mukil/jdeployer:R1.2
@nitinsatish
nitinsatish / regions_code.md
Created January 13, 2022 08:24
[AWS regions]#aws

Python code

regions = [r['RegionName'] for r in boto3.client('ec2').describe_regions()['Regions']]
@nitinsatish
nitinsatish / docker_image_cleanup.md
Created December 16, 2021 12:45
[Docker image cleanup] #docker
docker image prune -f
docker rmi $(docker images -q)
docker rm -v $(docker ps -qa)
@nitinsatish
nitinsatish / git_branch_issues.md
Last active May 20, 2021 10:17
[Git branch issues] #git

Make sure you've pulled the new upstream branch into your local repo:

  1. First, ensure your working tree is clean (commit/stash/revert any changes) Then,

git fetch upstream

to retrieve the new upstream branch 2. Create and switch to a local version of the new upstream branch (newbranch):

@nitinsatish
nitinsatish / ls.rst
Created April 16, 2021 07:50 — forked from amitsaha/ls.rst
How does `ls` work?

How does ls work?

I wanted to be really able to explain to a fair amount of detail how does the program :command:`ls` actually work right from the moment you type the command name and hit ENTER. What goes on in user space and and in kernel space? This is my attempt and what I have learned so far on Linux (Fedora 19, 3.x kernel).

How does the shell find the location of 'ls' ?

@nitinsatish
nitinsatish / tail.py
Created February 6, 2021 09:47 — forked from amitsaha/tail.py
Simple implementation of the tail command in Python
'''
Basic tail command implementation
Usage:
tail.py filename numlines
'''
import sys
import linecache