Skip to content

Instantly share code, notes, and snippets.

View chetan's full-sized avatar
🙌
like my work? sponsor me!

Chetan Sarva chetan

🙌
like my work? sponsor me!
View GitHub Profile
@weppos
weppos / capistrano_database_yml.rb
Created July 27, 2008 10:04
Provides a couple of tasks for creating the database.yml configuration file dynamically when deploy:setup is run.
#
# = Capistrano database.yml task
#
# Provides a couple of tasks for creating the database.yml
# configuration file dynamically when deploy:setup is run.
#
# Category:: Capistrano
# Package:: Database
# Author:: Simone Carletti <weppos@weppos.net>
# Copyright:: 2007-2010 The Authors
@julienXX
julienXX / .bashrc
Created May 25, 2009 12:42
My .bashrc
# Colors ----------------------------------------------------------
export TERM=xterm-color
export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
alias ls='ls -G' # OS-X SPECIFIC - the -G command in OS-X is for colors, in Linux it's no groups
#alias ls='ls --color=auto' # For linux, etc
# http://unicorn.bogomips.org/SIGNALS.html
rails_env = ENV['RAILS_ENV'] || 'production'
rails_root = ENV['RAILS_ROOT'] || "/data/github/current"
God.watch do |w|
w.name = "unicorn"
w.interval = 30.seconds # default
# unicorn needs to be run from the rails root
# This will ride alongside god and kill any rogue memory-greedy
# processes. Their sacrifice is for the greater good.
unicorn_worker_memory_limit = 300_000
Thread.new do
loop do
begin
# unicorn workers
#
@nragaz
nragaz / all.god
Created July 12, 2010 03:16
God configs for starting Resque and Unicorn
PID_DIR = '/srv/myapp/shared/pids'
RAILS_ENV = ENV['RAILS_ENV'] = 'production'
RAILS_ROOT = ENV['RAILS_ROOT'] = '/srv/myapp/current'
BIN_PATH = "/home/rails/.rvm/gems/ree-1.8.7-2010.02/bin"
God.log_file = "#{RAILS_ROOT}/log/god.log"
God.log_level = :info
%w(unicorn resque).each do |config|
God.load "#{RAILS_ROOT}/config/god/#{config}.god"
#!/custom/ree/bin/ruby
# USAGE:
#
# echo "|/path/to/core_helper.rb %p %s %u %g" > /proc/sys/kernel/core_pattern
#
require 'etc'
require 'net/smtp'
@mislav
mislav / pagination.md
Created October 12, 2010 17:20
"Pagination 101" by Faruk Ateş

Pagination 101

Article by Faruk Ateş, [originally on KuraFire.net][original] which is currently down

One of the most commonly overlooked and under-refined elements of a website is its pagination controls. In many cases, these are treated as an afterthought. I rarely come across a website that has decent pagination, and it always makes me wonder why so few manage to get it right. After all, I'd say that pagination is pretty easy to get right. Alas, that doesn't seem the case, so after encouragement from Chris Messina on Flickr I decided to write my Pagination 101, hopefully it'll give you some clues as to what makes good pagination.

Before going into analyzing good and bad pagination, I want to explain just what I consider to be pagination: Pagination is any kind of control system that lets the user browse through pages of search results, archives, or any other kind of continued content. Search results are the o

@fabiant7t
fabiant7t / s3_multipart_upload.py
Created April 17, 2011 14:54
Parallel S3 multipart upload with retries
import logging
import math
import mimetypes
from multiprocessing import Pool
import os
from boto.s3.connection import S3Connection
from filechunkio import FileChunkIO
@mguymon
mguymon / gist:981589
Created May 19, 2011 19:56
Buildr uberjar task using one-jar
# XXX: Set the deps you want
deps = []
deps << "com.thoughtworks.xstream:xstream:jar:1.3.1"
deps << "org.quartz-scheduler:quartz:jar:1.8.5"
task :uberjar => :package do |t|
assembly_dir = "target/assembly"
FileUtils.mkdir_p( "#{assembly_dir}/lib" )
@kimsterv
kimsterv / gist:1040741
Created June 22, 2011 18:23
Clean bad gzips
#!/bin/bash
for i in `hadoop fs -lsr /flume/incoming/2011/04 | awk '{print $8}'`; do
echo $i; hadoop fs -cat $i | gzip -t
if [ $? -ne 0 ] && [ -n "`echo \"$i\" | grep 'gz$'`" ]; then
`echo hadoop fs -rmr -skipTrash $i`
fi
done