Skip to content

Instantly share code, notes, and snippets.

View scoates's full-sized avatar

Sean Coates scoates

View GitHub Profile
alert('ownenated?')
alert('ownerened?')
@scoates
scoates / check_elb_healthy_hosts.py
Created June 27, 2013 17:22
Nagios plugin to monitor AWS/EC2 Elastic Load Balancers for healthy hosts
#!/usr/bin/env python
"""
A nagios plugin for ensuring that load balancers have at least a certain
number of healthy nodes.
Usage:
Nagios Command:
define command {
command_name check_elb_healthy_hosts
@scoates
scoates / twitter_user_to_image
Last active December 19, 2015 09:49
Get a twitter profile image from a username. We route around bad APIs. Twitter wears the scumbag hat, these days.
#!/bin/bash
# Usage: $0 username
# e.g.:
# $ ./twitter_user_to_image coates
# https://si0.twimg.com/profile_images/1597362183/me.jpg
curl -sL http://twitter.com/$1 | grep profile_images | head -n1 | perl -p -e's/.*?http/http/;s/".*//;s/_bigger//'
@scoates
scoates / keybase.md
Last active March 16, 2020 17:56
Keybase

Keybase proof

I hereby claim:

  • I am scoates on github.
  • I am scoates (https://keybase.io/scoates) on keybase.
  • I have a public key whose fingerprint is 8A45 6450 4355 2F7B FB92 5422 E905 36DD 957A 42BE

To claim this, I am signing this object:

@scoates
scoates / 0_reuse_code.js
Created July 24, 2014 15:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

WHAT?

<?php

function machine_forget(&$data) {
    $data = null;
}

$answer = 42;
@scoates
scoates / salt_roots_sshd-mfa_init.sls
Created March 13, 2015 19:15
SSH + MFA (with Google Authenticator) on Debian Wheezy
include:
# for backports
- apt
openssh6.6:
pkg.installed:
# backports; this number *will* change
- pkgs:
- openssh-server: 1:6.6p1-4~bpo70+1
- openssh-client: 1:6.6p1-4~bpo70+1
@scoates
scoates / timeline
Created April 15, 2015 02:25
Measure the time delta between lines in stdout
#!/usr/bin/env python
import time
from sys import stdin, stdout, argv, exit
try:
if argv[1] == 'help' or argv[1] == '--help' or argv[1] == '-h':
print "%s: times each line of stdin." % argv[0]
print " Optional parameter is a float of a threshold. (defaults to 2.0)"
exit(255);
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
based on https://raw.githubusercontent.com/saltstack/salt/develop/tests/eventlisten.py
'''
# Import Python libs
from __future__ import print_function
import optparse