Skip to content

Instantly share code, notes, and snippets.

View shrikanthkr's full-sized avatar
🏠
Working from home

Shrikanth shrikanthkr

🏠
Working from home
View GitHub Profile
@shrikanthkr
shrikanthkr / install-oh-my-zsh-on-ubuntu
Created January 31, 2016 14:03 — forked from richardtape/install-oh-my-zsh-on-ubuntu
Install Oh My ZSH on Ubuntu 14.04
# Where is the location of your current shall. Useful if we need to revert
echo $0
# Install ZSH
sudo apt-get install zsh
# Instal GIT
sudo apt-get install git-core
# Install OhMyZSH
@shrikanthkr
shrikanthkr / solarize-terminator.sh
Last active September 7, 2015 10:25 — forked from kynan/solarize-terminator.sh
shell script for setting terminator color palette to use Solarized theme
#!/bin/bash
#
# Shell script that configures terminator to use solarized theme
# colors. Assumes a single terminator profile. Tested on Ubuntu 11.10.
#
# Solarized theme: http://ethanschoonover.com/solarized
#
# Original from 79CetiB:
# http://www.reddit.com/r/emacs/comments/npfmv/i_need_some_help_with_the_solarized_theme_in_a/c3b4mds
#
# Probably excessive, but it makes these instructions simpler
sudo -i
# Add postgresql repo and update apt listing
echo "deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main" > /etc/apt/sources.list.d/pgdg.
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
# For some reason this is necessary with PostgreSQL on Ubuntu 12.04
update-alternatives --remove postmaster.1.gz /usr/share/postgresql/9.1/man/man1/postmaster.1.gz
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#

Basic Packages

sudo apt-get update
sudo apt-get install git-core python-software-properties software-properties-common

Install nginx

sudo add-apt-repository ppa:nginx/stable
sudo apt-get update

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
module MyApp
module Database
def connect(pool_size = nil, reap_time = nil)
return unless defined? ActiveRecord::Base
config = Rails.application.config.database_configuration[Rails.env]
config['reaping_frequency'] = reap_time || ENV['AR_DB_REAP_FREQ'] || 10 # seconds
config['pool'] = pool_size || ENV['AR_DB_POOL'] || 5
ActiveRecord::Base.establish_connection(config)
end
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by [email protected] http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
@shrikanthkr
shrikanthkr / gist:22b6b817fd2edb1b0e46
Last active August 29, 2015 14:03 — forked from cameronmccloud/gist:1258906
Socke IO testing
console.info("Socket.io chat test client");
io = require('socket.io-client');
var args = process.argv.slice(2);
Test = {};
Test.connections = parseInt(args[0]) || 100;
Test.completedProcesses = 0;
Test.failures = 0;
Test.pingServer = function(socket_n) {
var j = socket_n;
set mailserver smtp.gmail.com port 587 username "[email protected]" password "password" using tlsv1 with timeout 30 seconds