Skip to content

Instantly share code, notes, and snippets.

View phumpal's full-sized avatar
🌮

Patrick Humpal phumpal

🌮
  • Northern California
View GitHub Profile
{
"timestamp":"2014-05-03T01:55:11.241076+0000",
"level":"info",
"message":"handler output",
"handler":{
"type":"pipe",
"command":"/etc/sensu/handlers/slack.rb",
"token":"REDACTED",
"team_name":"REDACTED",
"channel":"#ops",
@phumpal
phumpal / rack_auth
Created August 11, 2014 17:54
Grab a Rackspace auth token
curl -s -d \
'{
"auth":
{
"RAX-KSKEY:apiKeyCredentials":
{
"username": "RACKSPACE_API_USERNAME",
"apiKey": "RACKSPACE_API_KEY"}
}
}' \
@phumpal
phumpal / bashfix.sh
Created September 26, 2014 22:22
Patches bash exploit on Debian / Ubuntu servers via cli and inventory file
ansible all -i production/inventory -m apt -a 'update_cache=yes name=bash state=latest' -s -k
@phumpal
phumpal / get_cloud_ips.rb
Last active August 29, 2015 14:08
Gather public cloud server IPs in a region and permits traffic to statsd/graphite
#!/usr/bin/env ruby
require 'fog'
connection = Fog::Compute.new({
:provider => 'rackspace',
:rackspace_username => ENV['RACKSPACE_API_USERNAME'],
:rackspace_api_key => ENV['RACKSPACE_API_KEY'],
:version => :v2,
:rackspace_region => :ord
@phumpal
phumpal / check-resque-queue-size.rb
Last active August 29, 2015 14:09
Checks the specified resque queue size
#!/usr/bin/env ruby
#
# Check the size of a resque queue
# ===
#
# Copyright 2014 Patrick Humpal <patrick@netvilla.net>
#
# Released under the same terms as Sensu (the MIT license); see LICENSE
# for details.
@phumpal
phumpal / ebs_raid.rb
Created June 7, 2011 05:54 — forked from tnine/ebs_raid.rb
Ebs raid mounting. Links to this jira issue http://tickets.opscode.com/browse/CHEF-2275
include Opscode::Aws::Ec2
#Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed
# Create multiple resources with new node: PASS
#
# Re-attach multiple resources after a reboot: PASS
#
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS
#
#!/bin/sh
set -u
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
APP_ROOT=/home/deploy/public_html/rm/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENV=production
@phumpal
phumpal / rbac.txt
Created May 30, 2012 16:55
LogZilla RBAC Update
*** logzilla-svn/html/includes/ajax/rbac.php 2012-05-30 09:53:41.000000000 -0700
--- logzilla/html/includes/ajax/rbac.php 2012-05-30 09:53:02.000000000 -0700
***************
*** 196,201 ****
--- 196,204 ----
if ($newkey > 0) {
$sql = "UPDATE hosts set rbac_key=$newkey WHERE host='$host'";
$result = perform_query($sql, $dbLink, $_SERVER['PHP_SELF']);
+ } elseif ($newkey == 0) {
+ $sql = "UPDATE hosts set rbac_key=1 WHERE host='$host'";
@phumpal
phumpal / runinenv.sh
Created November 5, 2012 09:37 — forked from parente/runinenv.sh
run a command in virtualenv, useful for supervisord
#!/bin/bash
VENV=$1
if [ -z $VENV ]; then
echo "usage: runinenv [virtualenv_path] CMDS"
exit 1
fi
. ${VENV}/bin/activate
shift 1
echo "Executing $@ in ${VENV}"
exec "$@"
@phumpal
phumpal / sensu-client.conf
Last active October 21, 2015 20:34
This is a simple upstart config for sensu-client
description "sensu-client"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
chdir /opt/sensu
pre-start script