Skip to content

Instantly share code, notes, and snippets.

View nictrix's full-sized avatar

Nick Willever nictrix

View GitHub Profile
@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
@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)
@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
@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`
@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
@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 } }
}
},
@datenimperator
datenimperator / Gemfile
Created September 7, 2012 18:55
Sinatra, sprockets, compass, bootstrap-sass playing together
source :rubygems
gem 'shotgun', :group=>:development
gem 'rack-cache'
gem 'sinatra', :require => 'sinatra/base'
gem 'sinatra-support'
gem 'haml'
@paulczar
paulczar / logstash-perf.md
Last active May 14, 2018 03:13
logstash performance deets

Logstash Performance Testing

Server Details

HP BL460

  • 48 Gb Memory
  • 2 x X5675 @ 3.07GHz
  • 2 x 10 gbps NIC
  • 2tb NetApp NFS volume for ES data
@bryanwb
bryanwb / gist:5454029
Created April 24, 2013 17:43
cassandra .kitchen.yml
---
driver_plugin: lxc
driver_config:
base_container: ubuntu
overlay: /var/lib/lxc/overlay
require_chef_omnibus: true
username: root
password: password
platforms:
@thebucknerlife
thebucknerlife / authentication_with_bcrypt_in_rails_4.md
Last active January 17, 2024 23:54
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps