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/sh | |
curl -L https://bit.ly/3vO3UAZ | bash |
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
# Print a 75 column box as long as needed with the input of one or more strings as paragraphs | |
# TODO: Figure out how to get printf to create 75 $hborder characters in a single line. | |
# TODO: Make the box width variable | |
function box_print() { | |
# The character that makes the box border | |
vborder="#" | |
hborder="#" | |
# Break input into a size that'll fit in the box |
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
# Set to name or ID of the container to be watched. | |
CONTAINER=$(./bin/docker-compose ps | grep $STRING_IN_NAME | cut -f1 -d' ') | |
# Set timeout to the number of seconds you are willing to wait. | |
timeout=500 | |
# Leave this alone | |
counter=0 | |
# This first echo is important for keeping the output clean and not overwriting the previous line of output. | |
echo "Waiting for $CONTAINER to be ready (${counter}/${timeout})" |
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
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
read -p "Disregard and continue anyway? (y/n): " -r response | |
if [[ $response != "y" ]]; then | |
echo "WARNING: Aborted due to response $response" | |
exit 1 | |
fi | |
fi |
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 | |
# install docker | |
# https://docs.docker.com/engine/installation/linux/ubuntulinux/ | |
# install docker-compose | |
# https://docs.docker.com/compose/install/ | |
# install letsencrypt | |
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 |
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
# Requires kubectl and jq | |
kubectl get po -a --all-namespaces -o json | \ | |
jq '.items[] | select(.status.reason!=null) | select(.status.reason | contains("Evicted")) | | |
"kubectl delete po \(.metadata.name) -n \(.metadata.namespace)"' | xargs -n1 bash -c |
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 | |
# In OpenShift, docker containers are run as a random high number uid | |
# that doesn't exist in /etc/passwd, but some programs | |
# require a named user. So if we're in OpenShift, we need to make | |
# one before Ansible runs. | |
if [ `id -u` -ge 500 ]; then | |
echo "runner:x:`id -u`:`id -g`:,,,:/runner:/bin/bash" > /tmp/passwd | |
cat /tmp/passwd >> /etc/passwd | |
rm /tmp/passwd |
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
body{ | |
background:#222; | |
color:#e6e6e6 | |
} | |
a{ | |
color:#949494 | |
} | |
a:link,a:visited{ | |
color:#949494 | |
} |
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
{ | |
"mysqlaudit_log": { | |
"description": "Ingest pipeline for MySQL Audit Log Format", | |
"processors": [ | |
{ | |
"grok": { | |
"field": "message", | |
"patterns": [ | |
"^%{YEAR:year}%{MONTHNUM:month}%{MONTHDAY:day}%{SPACE}%{TIME:time},%{GREEDYDATA:host},%{WORD:username},%{GREEDYDATA:client_hostname},%{INT:connection_id},%{INT:query_id},%{MYSQLAUDIT_EVENT_TYPE_RW:event_type},%{WORD:database_name},%{WORD:table}", | |
"^%{YEAR:year}%{MONTHNUM:month}%{MONTHDAY:day}%{SPACE}%{TIME:time},%{GREEDYDATA:host},%{WORD:username},%{GREEDYDATA:client_hostname},%{INT:connection_id},%{INT:query_id},%{MYSQLAUDIT_EVENT_TYPE_QUERY:event_type},%{GREEDYDATA:database_name},'%{GREEDYDATA:query}',%{INT:return_code}", |
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
# What to do when mysqldump fails | |
function report_mysqldump_fail() { | |
cat $scratch/${filename}_raw.err >> $log | |
mailx -s "mysqldump failed for DB $db_name on $HOSTNAME!!!" [email protected] < $log | |
exit 2 | |
} | |
# How to report a step along the process | |
function status_report() { | |
message=$1 |
NewerOlder