Skip to content

Instantly share code, notes, and snippets.

@sgtoj
sgtoj / provision.sh
Last active December 22, 2024 19:00
xx#!/usr/bin/env bash
# ------------------------------------------------------------ configuration ---
BREW_PACKAGES=(
awscli
bash
bat
eza
deno

Keybase proof

I hereby claim:

  • I am sgtoj on github.
  • I am sgtoj (https://keybase.io/sgtoj) on keybase.
  • I have a public key ASB_Va_bmMS89pI1oQuxOPhmPh2ywg8bZwFJ2G8Jv54bEgo

To claim this, I am signing this object:

@sgtoj
sgtoj / aws_sso.py
Last active October 2, 2024 14:22
AWS SSO Credentials File Updater for AWS SDKs
#!/usr/bin/env python3
import json
import os
import sys
from configparser import ConfigParser
from datetime import datetime
from pathlib import Path
import boto3
@sgtoj
sgtoj / copy_sm_secrets.py
Last active May 17, 2024 12:03
Python script to copy AWS SecretsManager Secrets
#!/usr/bin/env python3
import os
import sys
import boto3
from botocore.exceptions import ClientError
# -------------------------------------------------------------------- main ---
@sgtoj
sgtoj / review_sns_topics.py
Last active December 17, 2019 15:03
Python script to query and save all SNS topics and their attributes in a given region.
#!/usr/bin/env python3
import json
import re
import sys
import os
import boto3
# -------------------------------------------------------------------- main ---
@sgtoj
sgtoj / aws_mfa_login.py
Last active January 27, 2020 12:52
Simple Script to Create MFA Login Sessions for AWS CLI and SDK
#!/usr/bin/env python3
import sys
from configparser import SafeConfigParser
from pathlib import Path
import boto3
import botocore
AWS_PROFILE_PATH = f"{Path.home()}/.aws/credentials"
@sgtoj
sgtoj / transfer_ddb.py
Created August 6, 2019 12:13
Copy DynamoDB Table to Another Table
#!/usr/bin/env python3
import boto3
# parameters for source account
SRC_ACCOUNT_PROFILE = 'aws_profile_name'
SRC_ACCOUNT_REGION = 'us-east-1'
SRC_TABLE = 'your-source-table-name'
# parameters for destination account
DST_ACCOUNT_PROFILE = 'aws_profile_name'
@sgtoj
sgtoj / config_aws_raid.sh
Last active September 10, 2024 18:55
Configure Raid for AWS Instance (NVME Supported)
#!/usr/bin/env bash
# ========================================================== configurations ===
RAID_NAME=ephemeral_raid
RAID_DEVICE=/dev/md0
RAID_MOUNT_PATH=/mnt/ephemeral
# =============================================================== functions ===
@sgtoj
sgtoj / persistent_c_mount_wsl.sh
Last active June 24, 2024 21:32
Ubuntu for Windows: Mounting C: Drive to WSL's Root
# allow `mount` cmd without password
echo "$USER ALL=NOPASSWD: /bin/mount" | (sudo su -c 'EDITOR="tee -a" visudo')
# add the mount directive to `fstab`
sudo mkdir -p /c
sudo sh -c "echo '/mnt/c /c none bind' >> /etc/fstab"
# update to `.bashrc` to auto mount at login
echo "sudo mount -a" >> ~/.bashrc
# now reload it
source ~/.bashrc