Skip to content

Instantly share code, notes, and snippets.

@solarkennedy
solarkennedy / analyze.sh
Created February 25, 2018 19:39
List of mesos frameworks in the DC/OS Universe
#!/bin/bash
[[ -d universe ]] || git clone git@github.com:mesosphere/universe.git
for package_folder in universe/repo/packages/*/*; do
pushd "${package_folder}" 1>/dev/null
latest=$(ls -1 | sort -rn | head -n 1)
if [[ "$(jq -r .framework $latest/package.json)" == "true" ]]; then
jq -r .name "$latest/package.json"
fi
popd 1>/dev/null
@solarkennedy
solarkennedy / sensu_report
Last active December 26, 2017 10:27
A script to report on the failed checks from sensu. Great for putting in the motd: sensu_report -s my_sensu_server > /etc/motd
#!/usr/bin/env python2
import json,sys,urllib2,socket
GREEN = '\033[92m'
RED = '\033[91m'
CLEAR = '\033[0m'
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-s", "--server", dest="server",
@solarkennedy
solarkennedy / smartd_guess.rb
Created November 22, 2013 21:12
A puppet function to try to programmatically monitor smart disks
newfunction(:smartd_guess, :type => :rvalue, :doc =>
'smartd_guess tries to guess which block devices are available for smart
monitoring, and which should be ignored.
It iterates through the $::blockdevices fact, and returns an ARRAY of HASHES
compatible with the jhoblitt smartd module:
https://github.com/jhoblitt/puppet-smartd#devices
This function exists because smartd AUTOSCAN is too dumb, and manually
specifying smartd configs on a per server basis is not web-scale.
firewall
========
This type provides the capability to manage firewall rules within
puppet.
**Autorequires:**
If Puppet is managing the iptables or ip6tables chains specified in the
`chain` or `jump` parameters, the firewall resource will autorequire
those firewallchain resources.

firewall

This type provides the capability to manage firewall rules within puppet.

Autorequires:

If Puppet is managing the iptables or ip6tables chains specified in the chain or jump parameters, the firewall resource will autorequire those firewallchain resources.

@solarkennedy
solarkennedy / _instructions.sh
Last active November 7, 2015 18:15
img2xterm comparison
# To see the differences in your native terminal:
echo "Original img2xterm"
wget -O - https://gist.github.com/solarkennedy/2544a9fe9ff4d76bedbc/raw/5cdba46e06c81815f80838a1c3b58f41cd659cc3/bender.img2xterm.ascii
echo
echo "New libpng img2xterm"
wget -O - https://gist.github.com/solarkennedy/2544a9fe9ff4d76bedbc/raw/5cdba46e06c81815f80838a1c3b58f41cd659cc3/bender.new-img2xterm.ascii
@solarkennedy
solarkennedy / gist:7d81f60b05c3bde071e6
Created June 24, 2015 03:41
Script to print security changelogs on debian/ubuntu systems
#!/bin/bash
set -u
function analyze_aptget_line {
# Inst dpkg [1.16.1.2ubuntu7.5] (1.16.1.2ubuntu7.6 Ubuntu:12.04/precise-security [amd64])
package=$2
current_version="${3//[\[\]]}"
latest_version="${4//(}"
escaped_version=$(echo $current_version | sed -e 's/[]\/$*.^|[]/\\&/g')
echo "Package $package needs to be updated from $current_version to $latest_version:"