Skip to content

Instantly share code, notes, and snippets.

View NicosKaralis's full-sized avatar

Nicos Belo Karalis NicosKaralis

View GitHub Profile
@causztic
causztic / clockwork.rb
Last active December 18, 2019 02:00 — forked from rogercampos/clockwork.rb
Capistrano running clockwork as daemon with upstart
after "deploy:stop", "clockwork:stop"
after "deploy:start", "clockwork:start"
after "deploy:restart", "clockwork:restart"
set :clockwork_roles, :blabla
set :cw_log_file, "#{current_path}/log/clockwork.log"
set :cw_pid_file, "#{current_path}/tmp/pids/clockwork.pid"
set :rails_env, ENV['rails_env'] || ''
namespace :clockwork do
@rogercampos
rogercampos / clockwork.rb
Created September 6, 2012 21:56
Capistrano running clockwork as daemon
after "deploy:stop", "clockwork:stop"
after "deploy:start", "clockwork:start"
after "deploy:restart", "clockwork:restart"
namespace :clockwork do
desc "Stop clockwork"
task :stop, :roles => clockwork_roles, :on_error => :continue, :on_no_matching_servers => :continue do
run "if [ -d #{current_path} ] && [ -f #{pid_file} ]; then cd #{current_path} && kill -INT `cat #{pid
_file}` ; fi"
end
@chrishulbert
chrishulbert / colourise.m
Created June 19, 2011 11:47
Image manipulation in obj-c / iphone
typedef unsigned char byte;
#define Clamp255(a) (a>255 ? 255 : a)
+ (UIImage*) fromImage:(UIImage*)source toColourR:(int)colR g:(int)colG b:(int)colB {
// Thanks: http://brandontreb.com/image-manipulation-retrieving-and-updating-pixel-values-for-a-uiimage/
CGContextRef ctx;
CGImageRef imageRef = [source CGImage];
NSUInteger width = CGImageGetWidth(imageRef);
NSUInteger height = CGImageGetHeight(imageRef);