Skip to content

Instantly share code, notes, and snippets.

View Laxman-SM's full-sized avatar

Laxman Singh Laxman-SM

  • Ex-Phenome, Ex-Intertrust, Ex-Wipro
  • US, Hyderabad (india)
View GitHub Profile
@Laxman-SM
Laxman-SM / cdc
Created April 8, 2025 13:14 — forked from oguzhancoskun/cdc
AWS EKS Cilium Prefix Delegation Checker
#!/bin/bash
# Colors and styles
BOLD='\033[1m'
DIM='\033[2m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
@Laxman-SM
Laxman-SM / setup_and_run_terraformer.sh
Created March 31, 2025 06:49 — forked from darkn3rd/setup_and_run_terraformer.sh
Export Deployed TeamCity on Google Cloud to Terraform
##################
# Install Terraform with tfenv
# Ref: https://github.com/GoogleCloudPlatform/terraformer#installation
# For macOS with Homebrew: brew install tfenv
#############################
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
export PATH="$HOME/.tfenv/bin:$PATH"
echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bashrc
# install Terraform
tfenv install latest
@Laxman-SM
Laxman-SM / cloudflare.tf
Created March 31, 2025 06:40 — forked from darkn3rd/cloudflare.tf
Example Cloudflare
variable "records" {
description = "Cloudflare DNS zone records"
type = set(object({
tf_obj_id = string # tf key used to organize records
name = string
proxied = bool
value = string
priority = number
ttl = number
type = string
@Laxman-SM
Laxman-SM / monitors.tf
Created March 31, 2025 06:27 — forked from darkn3rd/monitors.tf
Datadog example for monitors
# Run Script to fetch monitors
# --------------------------------------
# WORKSPACE=$(terraform workspace show)
# [[ -d "./tfvars" ]] && VAR_DEFS_PATH="./tfvars"
# [[ -d ".././tfvars" ]] && VAR_DEFS_PATH=".././tfvars"
# [[ -z "$VAR_DEFS_PATH" ]] && { echo 'VAR_DEFS_PATH not specified. Aborting' >&2 ; exit 1; }
# DD_API_KEY="$(awk -F'"' '/dd_api_key/{ print $2 }' $VAR_DEFS_PATH/$WORKSPACE.secret.tfvars)"
# DD_APP_KEY="$(awk -F'"' '/dd_app_key/{ print $2 }' $VAR_DEFS_PATH/$WORKSPACE.secret.tfvars)"
# [[ -z "$DD_API_KEY" ]] && { echo 'DD_API_KEY not specified. Aborting' >&2 ; exit 1; }
# [[ -z "$DD_APP_KEY" ]] && { echo 'DD_APP_KEY not specified. Aborting' >&2 ; exit 1; }
@Laxman-SM
Laxman-SM / docker-login-ecr-sso.py
Created September 15, 2023 08:44 — forked from bdclark/docker-login-ecr-sso.py
Script to perform docker login to AWS ECR using AWS SSO config
#!/usr/bin/env python
import argparse
import configparser
from shutil import which
import subprocess
import sys
import os
CONFIG_PATH = os.path.expanduser("~/.aws/config")
@Laxman-SM
Laxman-SM / mirror-dockerhub-repos-to-ecr.sh
Created September 8, 2023 11:38 — forked from shmileee/mirror-dockerhub-repos-to-ecr.sh
Mirror all private images from DockerHub organisation to ECR
#!/bin/bash
ecr_url="<account id>.dkr.ecr.<region>.amazonaws.com"
# set username, password, and organization
dockerhub_username="<user>"
dockerhub_password="<password>"
dockerhub_organization="<org>"
dockerhub_api_url="https://hub.docker.com/v2"
dockerhub_token=$(curl -s -H "Content-Type: application/json" -X POST -d \
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: script
spec:
schedule: "*/2 * * * *"
jobTemplate:
spec:
template:
@Laxman-SM
Laxman-SM / myips.sh
Created August 11, 2023 04:07 — forked from haukurk/myips.sh
cli myips
# return my IP addresses
function myip() {
ExtIP=`dig TXT +short o-o.myaddr.l.google.com @ns1.google.com`
echo $ExtIP | tr -d '"' | awk '{print "external : " $1}'
ifconfig lo0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "lo0 : " $2}'
ifconfig en0 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en0 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en0 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en0 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en1 | grep 'inet ' | sed -e 's/:/ /' | awk '{print "en1 (IPv4): " $2 " " $3 " " $4 " " $5 " " $6}'
ifconfig en1 | grep 'inet6 ' | sed -e 's/ / /' | awk '{print "en1 (IPv6): " $2 " " $3 " " $4 " " $5 " " $6}'
}
@Laxman-SM
Laxman-SM / atlas.py
Created August 11, 2023 04:06 — forked from kenseii/atlas.py
Automating the IAM role connection to MongoDB atlas
import os
from pulumi import get_stack, get_project # so that each resource has a project & staging/dev... in AWS console
import pulumi_mongodbatlas as mongodbatlas
ACCOUNT_ID = os.environ["ACCOUNT_ID"]
ATLAS_PROJECT_ID = os.environ["ATLAS_PROJECT_ID"]
my_func_role_arn = f"arn:aws:iam::{ACCOUNT_ID}:role/{get_project()}-{get_stack()}-my-func-iam-role"
lambda_cloud_provider_access = mongodbatlas.CloudProviderAccess(
@Laxman-SM
Laxman-SM / parse-inventory-progress.py
Created August 11, 2023 04:04 — forked from alukach/parse-inventory-progress.py
Parsing S3 Inventory results in Python
#! /usr/bin/env python3
"""
A utility to stream records from one or many S3 Inventory reports, with a progress bar.
./parse-inventory-progress s3://my-bucket/path/to/my/inventory/2019-12-15T00-00Z/manifest.json > out.csv
"""
import json
import csv
import gzip
import sys