Skip to content

Instantly share code, notes, and snippets.

$:.unshift('~/rufus/rufus-tokyo/lib')
require 'benchmark'
require 'rubygems'
require 'faker'
require 'date'
#
# the data
#
require 'capistrano/recipes/deploy/strategy/remote'
module Capistrano
module Deploy
module Strategy
# Implements the deployment strategy that keeps a checkout of
# the source code on each remote server. Each deploy simply updates the
# checkout
class GitSync < Remote
@zev
zev / gist:199526
Created October 2, 2009 07:18
MultiProcess TokyoCabinet Reads
#!/usr/bin/ruby
require 'yaml'
require 'benchmark'
require 'rubygems'
require 'rufus/tokyo'
$cab_file = "cab_#{Process.pid}.tch"
pcount = (ARGV[0] || 2).to_i
# get the apps
#ey environments --all | grep -E "^\w"
# get the environments
#ey environments --all | grep -E "^\s+\w" | awk '{print $1}'
_ey_does_ssh_list_need_generating () {
if [ ! -f ~/.ey_ssh_lists ]; then return 0;
else
yesterday=$(date +%s -d yesterday)
zblut@zblut-benchmark smart_api (ey_appcloud) % ey deploy -a smart_api -e testdb -r ey_appcloud
Connecting to the server...
Beginning deploy for 'smart_api' in 'testdb' on server...
~> Deploying revision 8bbe781... Debugging why deploy is now failing and loosing current symlink.
~> Loading deployment task overrides from /data/smart_api/shared/cached-copy/config/eydeploy.rb
~> Pushing code to all servers
rsync: failed to set times on "/data/smart_api/shared/cached-copy/tmp": Operation not permitted (1)
rsync: recv_generator: mkdir "/data/smart_api/shared/cached-copy/tmp/cache" failed: Permission denied (13)
*** Skipping any contents from this failed directory ***
rsync: recv_generator: mkdir "/data/smart_api/shared/cached-copy/tmp/sessions" failed: Permission denied (13)
;; Fix indentation for buffer
(defun fix-read-only-indentation ()
"Fix the indentation of a read only file. For now you have to
remember to not save this change if you have write access to the
file"
(interactive)
(toggle-read-only)
(indent-region (point-min) (point-max)))
@zev
zev / *scratch*
Created September 1, 2010 09:08
sample conditional shell checks
# rough if else ...
execute "restarting-mysql-with-custom-config" do
command "/etc/init.d/mysql restart"
only_if "pgrep mysqld"
end
execute "starting-mysql-with-custom-config" do
command "/etc/init.d/mysql start"
not_if "pgrep mysqld"
@zev
zev / example_aws_s3_digest_usage.txt
Created September 3, 2010 10:21
How to send the hexdigest safely in s3
S3Object.store('lambda.jpg', d, 'mybucket', :content_type => 'image/jpeg', :content_md5 => Base64.encode64(Digest::MD5.digest(d)))
@zev
zev / gist:1196530
Created September 6, 2011 03:49
programming-praxis remove dup chars
;; solution for part 1 http://programmingpraxis.com/2011/09/02/two-string-exercises/
(defun rdup (str)
(defun rdup_ (str res)
(if (null str)
res
(if (member (car str) res)
(rdup_ (cdr str) res)
(rdup_ (cdr str) (append res (list (car str)))))))
(concat (rdup_ (string-to-list str) '())))