Skip to content

Instantly share code, notes, and snippets.

View garlandkr's full-sized avatar
🎯
Focusing

Ken Garland garlandkr

🎯
Focusing
View GitHub Profile
@masterzen
masterzen / scan.rb
Created February 24, 2012 16:27
Parse Puppet AST for global node variables
require 'puppet'
class Parser
def scan(input_file_name)
@input_file_name = input_file_name
environment = Puppet::Node::Environment.new
@known_resource_types = environment.known_resource_types
unless environment.known_resource_types.watching_file?(@input_file_name)
Puppet.info "rdoc: scanning #{@input_file_name}"
if @input_file_name =~ /\.pp$/
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@drawks
drawks / graphite
Created February 14, 2012 21:24
Graphite on uwsgi/nginx
#This is the "site config" for nginx
upstream django {
# Distribute requests to servers based on client IP. This keeps load
# balancing fair but consistent per-client. In this instance we're
# only using one uWGSI worker anyway.
ip_hash;
server unix:/tmp/uwsgi.sock;
}
server {
@joemiller
joemiller / sensu-handler-input-example.json
Created February 2, 2012 11:33
example json data passed into Sensu handlers via STDIN
{
"client":{
"name":"host01",
"address":"10.2.1.11",
"subscriptions":[
"all",
"env_qa",
"frontend",
"proxy",
"apache"
@pete-otaqui
pete-otaqui / find_in_branches
Created January 12, 2012 10:37
Find File Path Pattern in all git branches
#!/bin/bash
# Authored by Pete Otaqui <[email protected]>
#
# Core code taken from StackOverflow
# http://stackoverflow.com/questions/372506/how-can-i-search-git-branches-for-a-file-or-directory
#
# The author has placed this work in the
# Public Domain, thereby relinquishing all
# copyrights. Everyone is free to use, modify,
@colonD
colonD / logstash_daily.sh
Created January 4, 2012 18:00
Quick cron.daily script for stock Logstash/ES installation
#!/bin/sh
# Do elasticsearch optimize on logstash previous day index
# if $1 = all then optimize all indicies
esindex="/opt/elasticsearch/data/elasticsearch/nodes/0/indices"
# Grab yesterday's values
D=`date +%d -d yesterday`
M=`date +%m -d yesterday`
Y=`date +%Y -d yesterday`
@fetep
fetep / 00-logstash.conf
Created December 31, 2011 06:54
Logstash JSON filter
input {
file {
type => syslog
path => "/var/log/messages"
}
}
filter {
grok {
type => syslog
@garnaat
garnaat / gist:1539859
Created December 30, 2011 13:28
Enable debug output with boto and EC2
# This will cause full debug output to go to the console
>>> import boto
>>> boto.set_stream_logger('foo')
>>> ec2 = boto.connect_ec2(debug=2)
@louiszuckerman
louiszuckerman / gist:1346387
Created November 7, 2011 22:18
Logstash parser for ModSecurity/CRS entries in the Apache ErrorLog
Logstash Configuration...
input {
file {
format => "plain"
path => "/var/log/apache2/*error.log"
type => "apacheerror"
}
}
filter {
@nickethier
nickethier / build.sh
Created October 17, 2011 17:40
Logstash + Jenkins / FPM
#!/usr/bin/env bash
ruby_version="1.9.2-p180"
rpm_version="0.2"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
#make sure we have rvm
no_rvm=$(which rvm | grep 'no rvm')
if [ "$no_rvm" ] ; then
echo "install rvm"