Skip to content

Instantly share code, notes, and snippets.


Josiah Ritchie flickerfly

View GitHub Profile
flickerfly / Get-ServerDNSSettings.ps1
Created Nov 30, 2016
Check the DNS Settings for all Windows Servers
View Get-ServerDNSSettings.ps1
# Source:
# Could use error checking to not throw an alert when the server isn't accessible
$AllServers=Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*"}
ForEach ($Server in $AllServers){
$Result=Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'True'" -Property DNSServerSearchOrder -ComputerName $Server.Name
$output = new-object PSObject
$output | add-member NoteProperty "ComputerName" $Server.Name
$output | add-member NoteProperty "DNSServerSearchOrder" $Result.DNSServerSearchOrder
# 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
# Break input into a size that'll fit in the box
flickerfly /
Last active Feb 10, 2021
This bash loop will wait for a docker container by name (or ID) to get in a running state before it will allow further execution of the script.
# 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.
# Leave this alone
# 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})"
# 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!!!" < $log
exit 2
# How to report a step along the process
function status_report() {
flickerfly / start_docker_registry.bash
Created Sep 10, 2020 — forked from u1i/start_docker_registry.bash
Start docker registry with letsencrypt certificates and Basic Auth
View start_docker_registry.bash
#!/usr/bin/env bash
# install docker
# install docker-compose
# install letsencrypt
flickerfly /
Created Jul 28, 2020
Delete all Evicted pods across namespaces
# 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 \( -n \(.metadata.namespace)"' | xargs -n1 bash -c
flickerfly / MySQL Replication Check
Last active Mar 25, 2020 — forked from ssimpson89/MySQL Replication Check
Just a simple Mysql Replication Health Check script I wrote. You can put this in a cron.
View MySQL Replication Check
### VARIABLES ### \
MYSQL_CHECK=$(mysql -e "SHOW VARIABLES LIKE '%version%';" || echo 1)
SLAVE_STATUS=$(/usr/bin/mysql -e "SHOW SLAVE STATUS\G"|grep -v row)
LAST_ERRNO=$(echo "${SLAVE_STATUS}" | grep "Last_Errno:" | awk '{ print $2 }' )
SECONDS_BEHIND_MASTER=$(echo "${SLAVE_STATUS}" | grep "Seconds_Behind_Master:" | awk '{ print $2 }' )
IO_IS_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_IO_Running:" | awk '{ print $2 }' )
#!/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
View darkify_slack.css
flickerfly / mysqlaudit_log.json
Last active May 30, 2018
ElasticSearch ingest pipeline for mysql audit
View mysqlaudit_log.json
"mysqlaudit_log": {
"description": "Ingest pipeline for MySQL Audit Log Format",
"processors": [
"grok": {
"field": "message",
"patterns": [