Skip to content

Instantly share code, notes, and snippets.

View rajeshkp's full-sized avatar

Rajesh Koilpillai rajeshkp

View GitHub Profile
@jlebrech
jlebrech / run.sh
Created March 30, 2012 11:58
NGINX+RVM+UNICORN stack commands
echo precompile assets for production
rvmsudo RAILS_ENV=production bundle exec rake assets:precompile
echo restart unicorn
sudo kill `cat unicorn.pid`
echo start unicorn as production
rvmsudo unicorn_rails -c config/unicorn.rb -D --env production
@allenhwkim
allenhwkim / gist:1993750
Created March 7, 2012 15:18
fb_graph_overrides
module FbGraph
module Connections
module AdCampaigns
def ad_campaign!(options = {})
ad_campaign = post(options.merge(:connection => :adcampaigns))
fb_data = ad_campaign[:data]? ad_campaign[:data][:campaigns][ad_campaign[:id]] : ad_campaign
AdCampaign.new(ad_campaign[:id], options.merge(fb_data.symbolize_keys).merge(
:access_token => options[:access_token] || self.access_token
))
@fnichol
fnichol / README.md
Created February 26, 2012 01:23
A Common .ruby-version File For Ruby Projects

A Common .ruby-version File For Ruby Projects

Background

I've been using this technique in most of my Ruby projects lately where Ruby versions are required:

  • Create .rbenv-version containing the target Ruby using a definition name defined in ruby-build (example below). These strings are a proper subset of RVM Ruby string names so far...
  • Create .rvmrc (with rvm --create --rvmrc "1.9.3@myapp") and edit the environment_id= line to fetch the Ruby version from .rbenv-version (example below).

Today I learned about another Ruby manager, rbfu, where the author is using a similar technique with .rbfu-version.

@dewski
dewski / locally.sh
Created January 20, 2012 16:58 — forked from jasonroelofs/setup-statsd.sh
Turn an EC2 micro instance into a StatsD/Graphite server
ec2-authorize default -p 2003
@johnantoni
johnantoni / logrotate.capify
Created January 10, 2012 21:55
Install log rotate script for Capistrano
desc "Install log rotate script"
task :rotate_logs, :roles => :app do
set :use_sudo, true
default_run_options[:pty] = true
rotate_script = %Q{#{shared_path}/log/*.log {
daily
missingok
rotate 30
compress
size 5M
@devudilip
devudilip / SUBLIME TEXT2 INSTALLATION
Created October 22, 2011 08:54
HOW TO INSTALL SUBLIME TEXT 2 ON UBUNTU 11.10
#BECOME SUPER USER#
sudo -i
#add sublime to repository#
add-apt-repository ppa:webupd8team/sublime-text-2
#update#
/**
* Class that throttles requests. Ensures that the StartRequest cannot be called
* more than a given amount of time in any given interval.
*
* StartRequest blocks until this requirement is satisfied.
*
* TryStartRequest returns 0 if the request was cleared, or a non-0 number of
* millisecond to sleep before the next attempt.
*
* Simple usage, 10 requests per second:
@remi
remi / commit-msg
Created August 30, 2011 20:56
Git commit message spell check hook (kind of a proof of concept, but still usable)
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
@alkema
alkema / deploy.rb
Created July 9, 2011 20:01
Capistrano task for a Node.js app with github Forever and NPM.
set :application, "appname"
set :deploy_to, "/var/www"
set :scm, :git
set :repository, "[email protected]:user/app.git"
default_run_options[:pty] = true
set :user, "www-data"
set :domain, "foo.tld"
set :normalize_asset_timestamps, false
@padcom
padcom / install-git.sh
Created June 19, 2011 10:23
Automated install of Git host on Ubuntu 10.04 with authorization and web interface for browsing
#!/bin/sh
#
# install required packages
#
apt-get install apache2 git-core gitweb
#
# create folder to host the repositories
#