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
# https://dev.to/aws/orchestrating-hybrid-workflows-using-amazon-managed-workflows-for-apache-airflow-mwaa-2boc | |
from copy import copy | |
from mysql.connector import MySQLConnection, Error | |
from python_mysql_dbconfig import read_db_config | |
import sys | |
import csv | |
import boto3 | |
import json | |
import socket | |
def query_with_fetchone(query2run,secret,region): |
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 | |
# Example of secrets as environmental variables | |
def access_secrets_env(): | |
secrets = os.environ.get('secret_key', None) | |
return secrets | |
# Example of secrets from AWS secrets manager using "default" profile | |
# In reality, developers typically use specific profiles for specific projects. |
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
#!/bin/bash | |
DB_NAME=${1} | |
export PGPASSWORD= | |
DBMS_SHELL="psql -p 5432 -h localhost" | |
DBMS_USER="postgres" | |
#if [ "$1" = '--help' ]; then | |
if [[ ( "$1" == '--help' ) || ( "$1" == '-h' ) ]]; then | |
echo "usage: $0 [DB_NAME] [DBMS_SHELL]" |
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 pymysql | |
def execute(c, command): | |
c.execute(command) | |
return c.fetchall() | |
db = pymysql.connect(host='', port=3306, user='root', passwd='', db='', use_unicode=True, charset="utf8") | |
c = db.cursor() | |
for table in execute(c, "show tables;"): |
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
#!/bin/bash | |
# https://cmaster11.medium.com/how-to-get-notified-whenever-someone-logs-in-via-ssh-947a8f8d4f37 | |
# Edit the /etc/pam.d/sshd file and append the following line at the end: | |
# session [default=ignore] pam_exec.so /bin/bash /opt/notify-ssh.sh | |
# We want to trigger the script only when the SSH session starts. | |
# To be notified also when session closes, you can watch for | |
# the "close_session" value. | |
if [[ "$PAM_TYPE" != "open_session" ]]; then | |
exit 0 |
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 | |
print(os.environ['VAULT_PASSWORD']) |
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
resource "aws_iam_role" "vantage_cross_account_connection" { | |
name = "vantage_cross_account_connection" | |
assume_role_policy = <<EOF | |
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { |
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
# Fix "Green folders in WSL" | |
# https://unix.stackexchange.com/questions/94498/what-causes-this-green-background-in-ls-output | |
export LS_COLORS+=':ow=01;33' | |
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
# https://starship.rs/guide/#%F0%9F%9A%80-installation | |
# ~/.config/starship.toml | |
# Use custom format | |
format = """ | |
[┌───────────────────](bold green) | |
[│](bold green)$all | |
[└─>](bold green) """ | |
# Wait 25 milliseconds for starship to check files under the current directory. | |
scan_timeout = 25 |