This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
git config -f .gitmodules --get-regexp 'submodule\..*\.path' | while read -r key submodule_path; do | |
http_url=$(git config --file .gitmodules --get submodule.$submodule_path.url) | |
ssh_url=${http_url/https:\/\/github.com\//git@github.com:} | |
git config -f .gitmodules submodule.$submodule_path.url $ssh_url | |
git config -f .gitmodules submodule.$submodule_path.shallow true | |
echo "Updated $submodule_name ($submodule_path) URL:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo zgrep 'Ban' /var/log/fail2ban.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createGunzip } from 'node:zlib'; | |
import { text } from 'node:stream/consumers'; | |
import { GetObjectCommand, S3Client } from '@aws-sdk/client-s3'; | |
async function readGzippedFromS3(s3Client: S3Client, bucket: string, objectKey: string): Promise<string> { | |
const command = new GetObjectCommand({ | |
Bucket: bucket, | |
Key: objectKey, | |
}); | |
const response = await s3Client.send(command); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pptx import Presentation | |
from pptx.util import Inches | |
prs = Presentation() | |
# Slide 1: Title Slide | |
slide_1 = prs.slides.add_slide(prs.slide_layouts[0]) | |
title_1 = slide_1.shapes.title | |
subtitle_1 = slide_1.placeholders[1] | |
title_1.text = "Suspend Manager Event Flow Representation" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import re | |
import zipfile | |
import site | |
import argparse | |
"""Package this lambda""" | |
ignore = ["__pycache__", "_pytest"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
def list_and_update_lambdas(): | |
client = boto3.client('lambda') | |
paginator = client.get_paginator('list_functions') | |
response_iterator = paginator.paginate() | |
lambdas_updated_count = 0 | |
for page in response_iterator: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pandas as pd | |
from pymongo import MongoClient | |
import inquirer | |
import configparser | |
# pip install pymongo pandas openpyxl inquirer | |
config_file = 'to_excel.ini' | |
config_section = 'mongodb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import re | |
import requests | |
import configparser | |
import tempfile | |
import uuid | |
import argparse | |
import subprocess | |
import inquirer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from requests.auth import HTTPBasicAuth | |
def validate_hellosign_credentials(api_key): | |
url = 'https://api.hellosign.com/v3/account' | |
response = requests.get(url, auth=HTTPBasicAuth(api_key, '')) | |
if response.status_code == 200: | |
print("Valid HelloSign credentials") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` | |
export INSTANCE_ID=`curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id` | |
sudo cat /var/lib/cloud/instances/$INSTANCE_ID/user-data.txt |
NewerOlder