Skip to content

Instantly share code, notes, and snippets.

View HarshadRanganathan's full-sized avatar
💭
Buy me a coffee (https://ko-fi.com/harshadranganathan)

Harshad Ranganathan HarshadRanganathan

💭
Buy me a coffee (https://ko-fi.com/harshadranganathan)
View GitHub Profile
@HarshadRanganathan
HarshadRanganathan / emr.sh
Created October 24, 2023 09:38
Script to extract EMR jobs run using a particular Release Label
#!/bin/bash -xe
QUERIED_RELEASE="emr-5.29.0"
REGION="us-east-1"
LIST_CLUSTERS_COMMAND="aws emr list-clusters --region $REGION"
COUNTER=0
function CALL_API() {
if [ ! -v NEXT_TOKEN ]; then
CLI_OUTPUT=$($LIST_CLUSTERS_COMMAND)
# Installs a git helper function which retrieves the password or developer token from Secrets Manager
# directly for cloning a repository from a private git repo or pushing back changes upstream.
# Storing passwords and tokens in Secrets Manager eliminates the need to store any sensitive information on EFS.
# Steps:
# 1. Add your password or personal developer token to Secret Manager
# 2. Set the secret name, key & email in the script below
# 3. Clone your repository via HTTP with the user name in the url, e.g. "git clone http://username@github.com/...."
#!/bin/bash
@HarshadRanganathan
HarshadRanganathan / README.md
Last active June 3, 2023 18:36
Github Actions Notes
  • Context variables - availability varies based on workflow step
    • github e.g. ${{ github.actor }}
    • env
    • vars
    • job, jobs
    • steps
    • runner
    • secrets
    • strategy
  • matrix
@HarshadRanganathan
HarshadRanganathan / README.md
Last active May 11, 2023 10:00
AWS Cost Optimizations

S3

  • Enable Storage Lens
  • Enable Intelligent Tiering
  • Delete Incomplete Multipart Uploads
  • Expire Non-Current Versioned Objects
  • Add Lifecycle Rules

Lambda

@HarshadRanganathan
HarshadRanganathan / elasticsearch.md
Last active April 4, 2023 15:52
Notes for Elasticsearch Performance Considerations

☐ Refresh Interval

☐ Hot Shards

Batch Load

☐ Refresh Interval set to 0

☐ Replicas set to 0 and increased post data load

@HarshadRanganathan
HarshadRanganathan / kubectl.cmd
Created January 9, 2023 10:40
Useful Kubectl Commands
kubectl get pods --all-namespaces | grep -E OutOfcpu\|Evicted\|Completed\|OOMKilled\|Error\|ContainerStatusUnknown | awk '{print "kubectl delete po " $2 " -n " $1 }' | bash
@HarshadRanganathan
HarshadRanganathan / eks-upgrade-1.20-to-1.21.groovy
Created September 2, 2022 20:22
EKS Upgrade Jenkins Pipeline Scripts
#!/usr/bin/env groovy
final List<String> environments = Env.values().collect() { it.name() }
pipeline {
agent {
label any
}
parameters {
@HarshadRanganathan
HarshadRanganathan / scripts.mysql
Last active April 15, 2023 11:30
MySQL Scripts
/* Get currently running transactions */
select * from information_schema.innodb_trx
/* Get currently running transactions where tables in use */
select * from information_schema.innodb_trx where trx_tables_in_use = 1
/* show locked tables */
show open tables where in_use > 0 ;
SHOW ENGINE INNODB STATUS;
@HarshadRanganathan
HarshadRanganathan / lucidchart.md
Created August 4, 2022 11:41
Lucidchart Features
  • Match width and height
  • Magnetize
  • Notes
  • Actions
    • Link to pages
    • Layers (show current and future state)]
  • Presentation
@HarshadRanganathan
HarshadRanganathan / terraformPlanner.py
Last active July 28, 2022 11:45
Terraform Planner script
import glob
import json
import subprocess
import sys
import json
from pathlib import Path
env = 'alpha'
keyword = ''