Skip to content

Instantly share code, notes, and snippets.

Patrick Humpal phumpal

Block or report user

Report or block phumpal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View slack.output.json
{
"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 Aug 11, 2014
Grab a Rackspace auth token
View rack_auth
curl -s -d \
'{
"auth":
{
"RAX-KSKEY:apiKeyCredentials":
{
"username": "RACKSPACE_API_USERNAME",
"apiKey": "RACKSPACE_API_KEY"}
}
}' \
@phumpal
phumpal / bashfix.sh
Created Sep 26, 2014
Patches bash exploit on Debian / Ubuntu servers via cli and inventory file
View bashfix.sh
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 Aug 29, 2015
Gather public cloud server IPs in a region and permits traffic to statsd/graphite
View get_cloud_ips.rb
#!/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 Aug 29, 2015
Checks the specified resque queue size
View check-resque-queue-size.rb
#!/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.
View redis.logstash.filter.rb
input {
file {
path => "/var/log/redis/redis-server.log"
start_position => "beginning"
type => "redis"
add_field => { "role" => "redis" }
}
}
filter {
if [type] == "redis" {
@phumpal
phumpal / ebs_raid.rb
Created Jun 7, 2011 — forked from tnine/ebs_raid.rb
Ebs raid mounting. Links to this jira issue http://tickets.opscode.com/browse/CHEF-2275
View ebs_raid.rb
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
#
View gist:1999567
#!/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
LogZilla RBAC Update
View rbac.txt
*** 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 Nov 5, 2012 — forked from parente/runinenv.sh
run a command in virtualenv, useful for supervisord
View runinenv.sh
#!/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 "$@"
You can’t perform that action at this time.