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 | |
INSTANCE_NAME="my_instance" | |
DATABASE=database_name | |
RDS_HOST="[DATABASE].[REGION].rds.amazonaws.com" | |
RDS_SECRET="my-secret" # should have username and password properties | |
RDS_PORT=5432 | |
LOCAL_PORT=5433 | |
read username password < <(echo $(aws secretsmanager get-secret-value \ |
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 | |
keystore=$JAVA_HOME/lib/security/cacerts | |
certs=$(keytool \ | |
-list \ | |
-keystore generic-truststore.jks \ | |
-storepass "" | grep trustedCertEntry | grep -Eo "^[^,]*") | |
while read -r cert |
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
stages: | |
- versioning | |
versioning: | |
stage: versioning | |
image: | |
name: amazonlinux:latest | |
entrypoint: [""] | |
before_script: | |
- yum install -y jq git |
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 | |
if [ -z $1 ]; then | |
echo "encoded message required" | |
exit 1 | |
fi | |
aws sts decode-authorization-message --encoded-message "$1" | jq -r '.DecodedMessage' | jq '.' |
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 | |
usage() { echo "Usage: $0 [-n <string>] [-t <string>]" 1>&2; exit 1; } | |
while getopts ":n:t:" o; do | |
case "${o}" in | |
n) | |
namespace=${OPTARG} | |
;; | |
t) |
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 | |
while IFS= read -r pod; do | |
echo $pod | |
namespace=$(kubectl get pods -o wide --all-namespaces -o custom-columns=":metadata.name, :metadata.namespace" | grep $pod | awk '{print $2}') | |
if [ -n "$namespace" ]; then | |
echo "deleting $pod on namespace $namespace" | |
kubectl delete pod $pod --grace-period=0 --force -n $namespace | |
else | |
echo "$pod was not found." |
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 random | |
import string | |
import datetime | |
import requests | |
import time | |
# edit the following variables | |
owner = "YOUR_ORG" | |
repo = "YOUR_REPO" | |
workflow = "dispatch.yaml" |
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
# try this on : https://replit.com/@bertrandmartel/WikipediaExtractImages | |
import wikitextparser as wtp | |
import requests | |
import urllib.parse | |
r = requests.get( | |
'https://zh.wikipedia.org/w/api.php', | |
params={ | |
'action': 'parse', | |
'page': '蔣中正', |
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
aws iam deactivate-mfa-device --user-name MFA_NAME --serial-number "arn:aws:iam::ACCOUNT_ID:mfa/MFA_NAME" | |
aws iam delete-virtual-mfa-device --serial-number arn:aws:iam::ACCOUNT_ID:mfa/MFA_NAME | |
aws iam create-virtual-mfa-device --virtual-mfa-device-name MFA_NAME --outfile mfa --bootstrap-method QRCodePNG | |
aws iam enable-mfa-device --user-name MFA_NAME --serial-number "arn:aws:iam::ACCOUNT_ID:mfa/MFA_NAME" --authentication-code1 "CODE1" --authentication-code2 "CODE2" |
NewerOlder