This file contains hidden or 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 | |
| function delete_dynamodb() { | |
| echo "Deleting all DynamoDB table in ${region}" | |
| for table in $(aws dynamodb list-tables); do | |
| echo "Deleting ${table} DynamoDB table" | |
| aws dynamodb delete-table --table-name ${table} | |
| done | |
| } | |
| function delete_ecr() { |
This file contains hidden or 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 | |
| ACCOUNT_ID=$1 | |
| if [[ -z ${ACCOUNT_ID} || -s ${ACCOUNT_ID} ]]; then | |
| echo "How to use this script?" | |
| echo "./delete_ebs_snapshot.sh <AWS_ACCOUNT_ID>" | |
| exit 1 | |
| fi | |
| if [[ ! $(command -v jq) ]]; then echo "Please install jq"; fi |
This file contains hidden or 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 | |
| BIODATA=''' | |
| [{"_id":"5e0f13e6ad3dc1310495216c","index":0,"eyeColor":"green", | |
| "name":"Gabrielle","gender":"female"},{"_id":"5e0f13e6976ab8447d76e206", | |
| "index":1,"eyeColor":"blue","name":"Maryanne","gender":"female"}] | |
| ''' # https://www.json-generator.com/ | |
| # get the length of an array in JSON | |
| echo ${BIODATA} | jq '. | length' # 2 |
This file contains hidden or 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 | |
| PUSHBULLET_API_TOKEN="<PUSHBULLET_API_TOKEN>" | |
| vncserver 2&>1 /dev/null; ngrok tcp 5901 --region=ap > /dev/null & | |
| until [[ $(curl -sL http://localhost:4040/api/tunnels) ]]; do sleep 1; done | |
| NGROK_PUBLIC_ENDPOINT=$(curl -sL http://localhost:4040/api/tunnels | \ | |
| jq .tunnels[0].public_url | tr -d '"') # get public_url from API | |
| DATETIME=$(date +'%x %X') | |
| curl --silent -XPOST "https://api.pushbullet.com/v2/pushes" \ | |
| -H "Access-Token: ${PUSHBULLET_API_TOKEN}" \ |
This file contains hidden or 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
| package main | |
| import ( | |
| "bufio" | |
| "crypto/sha256" | |
| "encoding/hex" | |
| "fmt" | |
| "os" | |
| ) |
This file contains hidden or 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
| kind: StorageClass | |
| apiVersion: storage.k8s.io/v1 | |
| metadata: | |
| name: efs | |
| provisioner: example.com/efs | |
| --- | |
| apiVersion: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: efs-provisioner |
This file contains hidden or 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 requests | |
| import socket | |
| import json | |
| from sys import argv, exit | |
| from bs4 import BeautifulSoup | |
| from subprocess import check_output |
This file contains hidden or 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
| # Get AWS EC2 Instance internal DNS name from Instance Group | |
| # For `kubectl describe nodes` or whatever you want | |
| $ kubectl get nodes -o json | jq '.items[] | select(.metadata.labels["kops.k8s.io/instancegroup"] == "nodes").metadata.labels["kubernetes.io/hostname"]' | tr -d '"' | |
| ip-10-121-1-185.us-west-2.compute.internal | |
| ip-10-121-2-138.us-west-2.compute.internal | |
| ip-10-121-2-47.us-west-2.compute.internal | |
| ip-10-121-4-147.us-west-2.compute.internal | |
| ip-10-121-5-75.us-west-2.compute.internal |
This file contains hidden or 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/bash | |
| dependency=() | |
| command -v elasticdump > /dev/null || dependency+="elasticdump " | |
| command -v curl > /dev/null || dependency+="curl " | |
| command -v jq > /dev/null || dependency+="jq " | |
| if [[ ${#dependency[@]} -gt 0 ]]; then | |
| echo "Missing dependency: ${dependency[@]}" | |
| exit 1 | |
| fi |
This file contains hidden or 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
| [eventlistener:audiod] | |
| directory=/home/pi/audio-player/ | |
| command=/home/pi/.local/bin/gunicorn --bind 0.0.0.0:5000 wsgi:app ; the program (relative uses PATH, can take args) | |
| process_name=%(program_name)s ; process_name expr (default %(program_name)s) | |
| umask=022 ; umask for process (default None) | |
| user=pi ; setuid to this UNIX account to run the program | |
| autorestart=unexpected ; autorestart if exited after running (def: unexpected) | |
| stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) | |
| autostart=true ; start at supervisord start (default: true) |