Skip to content

Instantly share code, notes, and snippets.

View rammanokar's full-sized avatar

SSR rammanokar

View GitHub Profile
@rammanokar
rammanokar / finalize_and_delete_namespace.sh
Created September 23, 2024 04:22
finalize_and_delete_namespace.sh
#!/bin/bash
# ----------------------------------------------------------------------------
# Script: finalize_and_delete_namespace.sh
# Description: This script resolves a stuck Kubernetes namespace that is in
# "Terminating" state by removing the finalizers from the namespace,
# and then optionally deletes the namespace upon user confirmation.
#
# Created based on the steps provided in:
# https://repost.aws/knowledge-center/eks-terminated-namespaces
@rammanokar
rammanokar / github_repo_access_to_teams.sh
Created July 8, 2024 09:37
Automate GitHub Team Permissions with Bash Script
#!/bin/bash
# Define variables
ORG="myOrg"
TEAM="myTeam"
PERMISSION="push"
# Check if the team exists
team_exists=$(gh api \
-H "Accept: application/vnd.github+json" \
@rammanokar
rammanokar / docker-compose.yaml
Created February 5, 2024 10:09
kafka with SASL_PLAINTEXT
version: '2'
services:
kafka:
image: 'bitnami/kafka:latest'
ports:
- "9092:9092"
- "9094:9094"
volumes:
- "kafka_data:/bitnami"
@rammanokar
rammanokar / kubeClenaup.sh
Created July 4, 2023 17:09
**Kubernetes Cleanup Script: Efficiently scales down deployments of non-ready or CrashLoopBackOff pods, excluding cron jobs and system namespaces.
#!/bin/bash
# Function to get all namespaces
get_namespaces() {
kubectl get namespaces --no-headers -o custom-columns=NAME:.metadata.name | grep -Ev "^(kube-system|kube-public|kube-node-lease|istio.*|gke.*)$"
}
# Function to get pods based on condition
get_pods() {
local namespace=$1
"grinning","smiley","smile","grin","laughing","sweat_smile","joy","slightly_smiling_face","upside_down_face","wink","blush","innocent","heart_eyes","kissing_heart","kissing","relaxed","kissing_closed_eyes","kissing_smiling_eyes","yum","stuck_out_tongue","stuck_out_tongue_winking_eye","stuck_out_tongue_closed_eyes","money_mouth_face","hugging_face","thinking_face","zipper_mouth_face","neutral_face","expressionless","no_mouth","smirk","unamused","face_with_rolling_eyes","grimacing","relieved","pensive","sleepy","sleeping","mask","face_with_thermometer","face_with_head_bandage","dizzy_face","sunglasses","nerd_face","confused","worried","slightly_frowning_face","white_frowning_face","open_mouth","hushed","astonished","flushed","frowning","anguished","fearful","cold_sweat","disappointed_relieved","cry","sob","scream","confounded","persevere","disappointed","sweat","weary","tired_face","triumph","rage","angry","smiling_imp","imp","skull","skull_and_crossbones","hankey","japanese_ogre","japanese_goblin","ghost","ali
@rammanokar
rammanokar / sshIdleShutdown.service
Last active December 12, 2022 05:09
Script to Shutdown Idle linux server
[Unit]
Description=SSH idle shutdown
After=ssh.service
[Service]
ExecStart=/usr/bin/sshIdleShutdown.sh
Restart=on-failure
RestartSec=5s
@rammanokar
rammanokar / classify_tickets.py
Created December 3, 2022 17:19
ticket classification using BERT
import pandas as pd
from sklearn.model_selection import train_test_split
from transformers import BertTokenizer, BertForSequenceClassification
# load the labeled helpdesk ticket dataset
df = pd.read_csv("helpdesk_tickets.csv")
# preprocess the text data
tokenizer = BertTokenizer.from_pretrained("bert-base-uncased")
df["text"] = df["text"].apply(lambda x: tokenizer.tokenize(x))
@rammanokar
rammanokar / VPAtoCSV.md
Last active September 23, 2022 19:44
VPA Recommendation to CSV

VPA Recommendation to CSV

kubectl -n draco get vpa -o json | yq '.items[].status.recommendation.containerRecommendations[] | (.containerName +","+.target.cpu + "," + .upperBound.cpu +","+ .target.memory + "," + .upperBound.memory) '
@rammanokar
rammanokar / install.sh
Last active September 21, 2022 08:14
simple script to prepare bastion server
git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it
~/.bash_it/install.sh
# install fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install --all
#install zoxide
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
@rammanokar
rammanokar / .tmux.conf
Last active August 1, 2022 17:41
my tmux conf
set -g mouse on
bind C-c new-session
bind r source ~/.tmux.conf
set -sg escape-time 50
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'arcticicestudio/nord-tmux'
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'