Skip to content

Instantly share code, notes, and snippets.

View rajeshkp's full-sized avatar

Rajesh Koilpillai rajeshkp

View GitHub Profile
@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
@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.

@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
))
@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
@sowawa
sowawa / memcached
Created April 2, 2012 04:28
memcached start/stop script for rackhub
#! /bin/sh
#
# chkconfig: - 55 45
# description: The memcached daemon is a network memory cache service.
# processname: memcached
# config: /etc/sysconfig/memcached
# Source function library.
# . /etc/rc.d/init.d/functions
@macdonst
macdonst / imei.js
Created April 20, 2012 15:04
IMEI Plugin for PhoneGap 1.4.1
var IMEI = function(){};
IMEI.prototype.get = function(onSuccess, onFail){
return PhoneGap.exec(onSuccess, onFail, 'IMEI', 'get', []);
};
PhoneGap.addConstructor(function(){
PhoneGap.addPlugin('imei', new IMEI());
});
@paulmillr
paulmillr / active.md
Last active September 23, 2025 16:13
Most active GitHub users (by contributions). https://paulmillr.com

Most active GitHub users (git.io/top)

The list would not be updated for now. Don't write comments.

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Because of GitHub search limitations, only 1000 first users according to amount of followers are included. If you are not in the list you don't have enough followers. See raw data and source code. Algorithm in pseudocode:

githubUsers
@robotmay
robotmay / application_controller.rb
Created May 16, 2012 11:12
Examples of low level caching
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter do
@categories = Rails.cache.fetch("global/categories", expires_in: 10.minutes) do
Category.where("posts_count > 0").all
end
end
end
@dstroot
dstroot / install-redis.sh
Created May 23, 2012 17:56
Install Redis on Amazon EC2 AMI
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
set :max_asset_age, 2 ## Set asset age in minutes to test modified date against.
after "deploy:finalize_update", "deploy:assets:determine_modified_assets", "deploy:assets:conditionally_precompile"
namespace :deploy do
namespace :assets do
desc "Figure out modified assets."
task :determine_modified_assets, :roles => assets_role, :except => { :no_release => true } do
set :updated_assets, capture("find #{latest_release}/app/assets -type d -name .git -prune -o -mmin -#{max_asset_age} -type f -print", :except => { :no_release => true }).split