This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PassengerMaxPoolSize to 30 in httpd.conf (recommended for 2 GB of RAM) | |
bin/passenger-memory-stats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scope :ranked, select('rubygems.name, rubygem_id, | |
COUNT(distinct machine_id) as machine_count, | |
COUNT(distinct platform_id) as platform_count, | |
GROUP_CONCAT(version_list) as version_list'). | |
joins(:rubygem).group(:rubygem_id). | |
order('machine_count DESC, platform_count DESC, rubygems.name') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Trigger to maintain a log of changes to the Users table (T-SQL, SQL Server 2005) | |
-- Presently only tracking UPDATEs | |
-- Inspiration from: http://goo.gl/Geds | |
IF OBJECT_ID('tr_ChangeLogOnUsers', 'TR') IS NOT NULL | |
DROP TRIGGER tr_ChangeLogOnUsers; | |
GO | |
CREATE TRIGGER tr_ChangeLogOnUsers ON Users FOR UPDATE | |
AS | |
-- only when LastModifiedBy is changed (someone made a change vs. something) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find admin users assigned to a given set of sites | |
named_scope :assigned_to_sites, lambda { |site_ids| | |
{ | |
:joins => :admin_user_site_assignments, | |
:conditions => { | |
:admin_user_site_assignments => {:site_id => site_ids} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function ListSplit(list, chunk_size, delim) | |
{ | |
var result = ArrayNew(1); var re = ""; var start = 1; | |
while(1) { | |
re = REFind("((?:[^#delim#]+#delim#){1,#chunk_size#})", list & delim, start, "true"); | |
if( re.len[1] eq 0 ) break; | |
ArrayAppend(result, Mid(list,re.pos[1],re.len[1]-len(delim))); | |
start = re.pos[1] + re.len[1]; | |
if(start gte len(list)) break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- osascript ~/styleterm.scpt 'Red Sands' | |
-- http://superuser.com/questions/187591/os-x-terminal-command-to-change-color-themes | |
on run argv | |
tell application "Terminal" to set current settings of selected tab of front window to first settings set whose name is (item 1 of argv) | |
end run | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant::Config.run do |config| | |
# Every Vagrant virtual environment requires a box to build off of. | |
config.vm.box = "debian_squeeze_32" | |
# The url from where the 'config.vm.box' box will be fetched if it | |
# doesn't already exist on the user's system. | |
config.vm.box_url = "http://mathie-vagrant-boxes.s3.amazonaws.com/debian_squeeze_32.box" | |
# Assign this VM to a host only network IP, allowing you to access it via the IP. | |
config.vm.network "33.33.33.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :user, 'vagrant' | |
set :run_method, :sudo | |
role :app, '33.33.33.10' | |
ssh_options[:keys] = `vagrant ssh_config | grep IdentityFile`.split.last |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
namespace :git do | |
GITHUB_COMMIT_URL = "https://github.com/path/to/your/repo/commit/" # <= set me | |
# Before doing a deploy, I like to check GitHub's branch list | |
# but I wanted to be able to save it in a Lighthouse message | |
COMPARE_FOR = { | |
'production' => 'origin/production..origin/release', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I forgot the firmware password on my MacBook Air and didn't want to take it in: | |
# http://support.apple.com/kb/TS2391 | |
# info | |
# http://paulmakowski.blogspot.com/2009/03/apple-efi-firmware-passwords.html | |
# run the following command to retrieve your obfuscated firmware password: | |
# sudo nvram -p | grep security-password | |
security_password = "%..." | |
# take the complement of every second bit: |