Skip to content

Instantly share code, notes, and snippets.

View briandemant's full-sized avatar
💭
is happy coding

Brian Demant briandemant

💭
is happy coding
View GitHub Profile
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery # :secret => '7062f5deb1b5157b7df647c519a0de7f'
# Portable monkey patch for reloading constants before hitting metal
# applications. More details in the introduction article at:
#
# http://roman.flucti.com/reloading-rails-metal-applications
#
Rails::Rack::Metal.class_eval do
# Prevent Metal from further require'ing source files, in order to let
# AS::Dependencies handle constants.
class << self
#!/usr/bin/env ruby
#
# Be sure to configure this node in the plugin configuration
# Memory stats must be run by root
# Ex:
# [passenger_memory]
# user root
# env.memory_stats_command path_to_passenger-memory-stats
#
#!/usr/bin/env ruby
#
# [passenger_processes]
# user root
# env.process_stats_command /opt/ruby-enterprise-1.8.6-20080810/bin/passenger-status
#
process_stats_command = ENV['process_stats_command'] || '/opt/ruby-enterprise-1.8.6-20080810/bin/passenger-status'
if ARGV.length > 0 && ARGV[0] == 'config'
#!/usr/bin/env ruby
command = '/usr/bin/passenger-memory-stats'
memory_limit = 200 # megabytes
def running?(pid)
begin
return Process.getpgid(pid) != -1
rescue Errno::ESRCH
return false
#!/usr/bin/env ruby
def running?(pid)
begin
return Process.getpgid(pid) != -1
rescue Errno::ESRCH
return false
end
end
We couldn’t find that file to show.
#!/usr/bin/env ruby
#
# Find bloating passengers and kill them gracefully. Run from cron every minute.
#
# required for passenger since cron has no environment
ENV['HTTPD'] = 'httpd'
MEM_LIMIT = ARGV[0] || 500
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
@briandemant
briandemant / grap a frame
Created May 6, 2009 21:50
video encoding scripts
#! /bin/bash
#
# this doesn't get ALL frames, it just grabs one!
#
# see: http://stream0.org/2008/02/howto-extract-images-from-a-vi.html
# for howto extract other images or ... do other stuff
#
INPUT="$1"
OUTPUT="$2"
if [[ -f "$INPUT" ]] && [[ -n "$OUTPUT" ]]; then