Skip to content

Instantly share code, notes, and snippets.

Avatar

Nicos Belo Karalis NicosKaralis

View GitHub Profile
@causztic
causztic / clockwork.rb
Last active Dec 18, 2019 — forked from rogercampos/clockwork.rb
Capistrano running clockwork as daemon with upstart
View clockwork.rb
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 Sep 6, 2012
Capistrano running clockwork as daemon
View clockwork.rb
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 Jun 19, 2011
Image manipulation in obj-c / iphone
View colourise.m
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);