You can now find this article on my blog : http://wp.me/p6W-6p
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
# put this in your Capistrano recipe | |
def subenv_string(env, *keys) | |
(env.keys & keys).map {|k| "#{k}=#{env[k].inspect}" }.join(' ') | |
end | |
# Capistrano task | |
namespace :deploy | |
task :my_cap_task do | |
task_env = subenv_string(ENV, *%w(FOO BAR)) | |
run "cd #{current_path} && #{rake} RAILS_ENV=#{rails_env} #{task_env} my_rake_task" |
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
function tmproj(){ | |
file=${PWD##*/}.tmproj | |
if [ -f $file ]; then | |
command open ./$file | |
else | |
command mate . | |
fi | |
} |
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
#!/bin/bash | |
set -e | |
# overridable defaults | |
GEM_HOME=${GEM_HOME:-/usr/local/passenger} | |
PASSENGER_BIN_PATH=${PASSENGER_BIN_PATH:-$GEM_HOME/bin} | |
PASSENGER_TMPDIR=${PASSENGER_TMPDIR:-/var/tmp} | |
PATH=$PATH:$PASSENGER_BIN_PATH |
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
#!/bin/bash | |
set -e | |
DIR=/var/log/apache-status | |
URL=http://example.com/server-status/ | |
TS=`date +%Y%m%d%H%M%S` | |
FILE="$DIR/$TS.html" | |
mkdir -p $DIR |
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
#!/bin/bash | |
set -e | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $all | |
# Required-Stop: $network $local_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 |
In a situation like this (pseudo code)
assert a_method(with, many, arguments)
I'd like to select the a_method(...)
part, launch a macro/command/whatever and get that :
variable = a_method(with, many, arguments)
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
#!/usr/bin/env ruby -wKU | |
# Save: Nothing | |
# Input: Document | |
# Output: Replace Input | |
# Caret Placement: Line Interpolation | |
COCOA_DIALOG_COMMAND = "#{ENV["TM_SUPPORT_PATH"]}/bin/CocoaDialog.app/Contents/MacOS/CocoaDialog" |
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
task :test_signal => :environment do | |
last_record = nil | |
puts $$ | |
Signal.trap('USR1') do | |
puts last_record.id | |
end | |
Model.find_in_batches do |batch| | |
batch.each do |item| |
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
→ dig www.destroyallsoftware.com | |
; <<>> DiG 9.8.3-P1 <<>> www.destroyallsoftware.com | |
;; global options: +cmd | |
;; Got answer: | |
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32151 | |
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0 | |
;; QUESTION SECTION: | |
;www.destroyallsoftware.com. IN A |