Skip to content

Instantly share code, notes, and snippets.

View ThabetAmer's full-sized avatar
🎯
In the search for a new challenge!

Thabet Amer ThabetAmer

🎯
In the search for a new challenge!
View GitHub Profile
@ThabetAmer
ThabetAmer / s3-make-public-from-other.sh
Created October 5, 2020 09:34
AWS S3 bash script to make recent objects uploaded by other owners publicly accessible
#!/bin/bash
BUCKET=
PROFILE_OTHER=
PROFILE_MINE=
DATE=$(date +%Y-%m-%dT%H:00:00)
IFS=$'\t'
@ThabetAmer
ThabetAmer / get_tables_counts.sql
Created November 22, 2021 12:51
SQL query to list numbers of rows in each table in a db schema
# tested on Mysql 5.7-8
# set database schema name to run against
SET @db_name = "DBNAME";
# actual query, two columns resulted: table name and its rows count
SELECT
TABLE_NAME,
SUM(TABLE_ROWS) as c
FROM
@ThabetAmer
ThabetAmer / get_aws_account_no.sh
Created December 8, 2021 07:58
Returns AWS account number from cli
aws sts --profile "${PROFILE:=default}" get-caller-identity --output text --query 'Account'
@ThabetAmer
ThabetAmer / get-route53-domain-records.sh
Created August 26, 2023 05:49
Retrieves DNS zone records for a domain on AWS Route53
#!/bin/bash
# @description : retrieves DNS zone records for a domain hosted on AWS Route53
# @usage : bash get-route53-domain-records.sh example.com
# @requirements: proper awscli v2 setup
# @input : domain name, you own!
# @output : text formatted records
DOMAIN=$1
test -z "$DOMAIN" && { echo "ERROR: no domain value is set" && exit -1; }