Skip to content

Instantly share code, notes, and snippets.

Patrick Humpal phumpal

View GitHub Profile
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 / 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.
@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 / 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 / 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"}
}
}' \
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",
View build_mysql51.sh
#!/bin/bash
set -e
sudo apt-get install librealine-dev libssl-dev libncurses5-dev -y
cd ~/
wget http://downloads.mysql.com/archives/mysql-5.1/mysql-5.1.65.tar.gz
tar -zxf mysql-5.1.65.tar.gz
cd mysql-5.1.65
./configure '--prefix=/usr' '--exec-prefix=/usr' '--libexecdir=/usr/sbin' '--datadir=/usr/share' '--localstatedir=/var/lib/mysql' '--includedir=/usr/include' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-system-type=debian-linux-gnu' '--enable-shared' '--enable-static' '--enable-thread-safe-client' '--enable-assembler' '--enable-local-infile' '--with-fast-mutexes' '--with-big-tables' '--with-unix-socket-path=/var/run/mysqld/mysqld.sock' '--with-mysqld-user=mysql' '--with-libwrap' '--without-readline' '--with-ssl' '--without-docs' '--with-extra-charsets=all' '--with-plugins=max' '--with-embedded-server' '--with-embedded-privilege-control'
@phumpal
phumpal / robots.txt
Last active Dec 20, 2015
Magento robots.txt template
View robots.txt
# Google Image Crawler Setup
User-agent: Googlebot-Image
Disallow:
# Crawlers Setup
User-agent: *
# Directories
Disallow: /404/
Disallow: /app/
@phumpal
phumpal / Vagrantfile
Created Jul 11, 2013
Simple Vagrant file for vmware_fusion provider
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "gtl"
config.vm.box_url = "http://files.vagrantup.com/precise64_vmware.box"
config.vm.network :public_network
@phumpal
phumpal / 1hosts
Last active Dec 17, 2015
When pyyaml.org is down my VM builds containing @rvm #fail. I have a VM running a barebones Nginx on 192.168.1.214
View 1hosts
/private/etc/hosts
192.168.1.214 pyyaml.org
You can’t perform that action at this time.