Skip to content

Instantly share code, notes, and snippets.

Robert Fairburn rfairburn

View GitHub Profile
View yamltest.py
#!/usr/bin/env python
import sys
import yaml
from pprint import pprint
filename = sys.argv[1]
with open(filename, 'r') as yaml_file:
try:
@rfairburn
rfairburn / manage_ec2.py
Last active Oct 30, 2015
Generate a list of EC2 instances and prompt to SSH into one
View manage_ec2.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This script will list all hosts in an ec2 region and prompt you to connect
to them.
It expects the file .boto to exist in your home directory with contents
as follows:
@rfairburn
rfairburn / .vpn_helpers.sh
Last active Sep 26, 2018
Mac OS X command-line VPN Helpers
View .vpn_helpers.sh
#!/bin/bash
# Source this file in your .bash_profile e.g.:
#
# source ~/gitcheckouts/vpn_heplers/.vpn_helpers.sh
#
# Note: This script works best with NOPASSWD: ALL configured in your sudoers file:
# /etc/sudoers:
# %admin ALL=(ALL) NOPASSWD: ALL
#
@rfairburn
rfairburn / checkdownminions.sh
Last active Aug 29, 2015
Check for down minions until all are up (good after a salt-master restart)
View checkdownminions.sh
#!/bin/bash
count=0
while : ; do
minions=$(salt-run manage.down)
let count=count+1
if [ -n "${minions}" ]; then
echo -e "The following minions are down:\e[0;31m "${minions}"\e[0m. Waiting for them to recover."
else
echo -e "\e[0;32mAll minions are running!\e[0m"
View nagios2yaml.sh
#!/bin/bash
# shell script to convert a nagios .cfg file to yaml compatible with my nagios formula.
FILENAME=$1
DESTINATION=$2
GENERATED_FILENAME=$3
OBJECTTYPES=$(cat ${FILENAME} | awk '{ if ($1 == "define") { print $2 }}' | sed 's/{//' | sort -u)
awkit() {
You can’t perform that action at this time.