Installing Supervisor on OS X is simple:
sudo pip install supervisor
This assumes you have pip. If you don't:
/** | |
* An extension that always calls success when a spy is called. | |
* | |
* @example | |
* spyOn(foo, 'bar').andCallSuccessWith("baz"); | |
* var options = { | |
* success: jasmine.createSpy(); | |
* } | |
* foo.bar(options); | |
* expect(options.success).toBeCalledWith("baz"); |
#controller | |
@start_date = Date.civil(params[:range][:"start_date(1i)"].to_i,params[:range][:"start_date(2i)"].to_i,params[:range][:"start_date(3i)"].to_i) | |
#view | |
<%= date_select('range', 'start_date', :order => [:month, :day, :year])%> |
GREEN="\[\033[0;32m\]" | |
WHITE="\[\033[1;37m\]" | |
# Get the name of the current git branch | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
# Update the command prompt to be <current_directory>(git_branch) > | |
# Note that the git branch is given a special color |
/usr/local/opt/varnish/sbin/varnishd -f /usr/local/etc/varnish/default.vcl -a 0.0.0.0:3001 |
for i in {0..10}; do curl -w "time %{time_total}\n" -o /dev/null -L http://viki.com 2>&1; done | grep time | awk '{sum+=$2}END{print sum/10}' |
while true | |
begin | |
sleep 5 | |
puts 'ping' | |
rescue Exception => ex | |
puts "Urghh.. brains" | |
end | |
end |
# Credit Brandon Weiss of http://anti-pattern.com/dirty-associations-with-activerecord | |
# app/models/dirty_associations.rb | |
module DirtyAssociations | |
attr_accessor :dirty | |
attr_accessor :_record_changes | |
def make_dirty(record) | |
self.dirty = true | |
self._record_changes = record |
Fabric is a deployment management framework written in Python which makes remotely managing multiple servers incredibly easy. If you've ever had to issue a change to a group servers, this should look pretty familiar:
for s in $(cat servers.txt); do ssh $s service httpd graceful; done
Fabric improves on this process by providing a suite of functions to run commands on the servers, as well as a number of other features which just aren't possible in a simple for loop. While a working knowledge of Python is helpful when using Fabric, it certainly isn't necessary. This tutorial will cover the steps necessary to get started with the framework and introduce how it can be used to improve on administering groups of servers.