Skip to content

Instantly share code, notes, and snippets.

View nictrix's full-sized avatar

Nick Willever nictrix

View GitHub Profile
@deverton
deverton / logstash-template.json
Created June 22, 2012 04:49
Logstash Elasticsearch Template
{
"template": "logstash-*",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@message" },
"store" : { "compress" : { "stored" : true, "tv": true } }
}
},
@jtimberman
jtimberman / knife.rb
Created February 1, 2012 19:33
Commented knife.rb for all the things
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
@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`
@mitchellh
mitchellh / gist:1317151
Created October 26, 2011 17:55
Chef file lock to enforce only one chef run
# Putting this at the top of your "base" recipe or some common recipe that
# is loaded very early on will force Chef to only run one process at a time.
# This is enforced using a file lock. The file lock is automatically released
# when the process exits, so there is no need to explicitly do so.
#----------------------------------------------------------------------
# Obtain File Lock
#----------------------------------------------------------------------
$_chef_lock_file = File.open(File.join(Chef::Config[:file_cache_path], "chef_lock"), "w+")
if $_chef_lock_file.flock(File::LOCK_EX | File::LOCK_NB) === false
@fennb
fennb / gist:1283573
Created October 13, 2011 06:35
nginx microcaching config example
# Set cache dir
proxy_cache_path /var/cache/nginx levels=1:2
keys_zone=microcache:5m max_size=1000m;
# Virtualhost/server configuration
server {
listen 80;
server_name yourhost.domain.com;
# Define cached location (may not be whole site)
@andreacfm
andreacfm / resque_worker_upstart.sh
Created October 3, 2011 15:33
resque workers via upstart runned by unpriviledge user
#!upstart
description "Workers [resque]"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn
respawn limit 99 5
console none