Skip to content

Instantly share code, notes, and snippets.

rkjha / style.css
Created March 22, 2012 16:52 — forked from kristi/style.css
OSQA theme style
View style.css
* OSQA theme style.css
* Modified the default OSQA style, removing a lot of backgrounds and drop shadows.
* Replace the file at osqa-server/forum/skins/default/media/style/style.css
* Original source from OSQA v0.9 beta2
* Last modified: Feb 23, 2011
rkjha /
Created April 28, 2012 20:30
Install necessary Programs in Ubuntu 12.04 LTS
# A simple shell script for installing my favorite stuffs on
# Ubuntu 12.04 LTS
# Author : Ramesh Jha <>, <>
# License : MIT
# update your system
sudo apt-get update
sudo apt-get upgrade
rkjha /
Created July 18, 2012 16:25 — forked from avar/
Goose Goose Go
#!/usr/bin/env perl
use v5.10;
use warnings FATAL => "all";
use Dancer;
use URI::Escape qw(uri_escape_utf8);
# This is all the search engine does
get '/search' => sub {
given (param("q")) {
when (/^(?:!(?:ducky)?\s+|\\)(.*)/) { redirect '' . uri_escape_utf8 $1 }
rkjha / unicorn.rb
Created January 6, 2013 16:18
View unicorn.rb
root = "/home/mrhuman/apps/YOUR_APP_NAME/current"
working_directory root
pid "#{root}/tmp/pids/"
stderr_path "#{root}/log/unicorn.log"
stdout_path "#{root}/log/unicorn.log"
# change the YOUR_APP_NAME to your application name
listen "/tmp/unicorn.YOUR_APP_NAME.sock"
worker_processes 2
timeout 30
rkjha / Capfile
Created January 6, 2013 16:19
View Capfile
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
rkjha /
Created January 6, 2013 16:21
set -e
# Feel free to change any of the following variables for your app:
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"
set -u
rkjha / deploy.rb
Last active December 10, 2015 17:29
Capistrano deploy.rb
View deploy.rb
require "bundler/capistrano"
#require "delayed/recipes"
server "YOUR_IP_ADDRESS", :web, :app, :db, primary: true
set :rails_env, "production" #added for delayed job
set :application, "YOUR_APP_NAME"
set :user, "mrhuman"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
rkjha / database.yml
Last active December 10, 2015 17:38
View database.yml
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
adapter: sqlite3
database: db/test.sqlite3
pool: 5
rkjha /
Created April 11, 2013 15:31
Apache VirtualHost Configuration
<VirtualHost *:80>
DocumentRoot /home/user_name/
<VirtualHost *:80>
Redirect permanent /
rkjha / frequency_db.rb
Last active December 18, 2015 00:09
First ruby program reads a file containing numbers (separated by space), and calculates the each occurrence of the number (a.k.a frequency distribution). Second one, simply prints a number from 1 to n with the condition (if it's divisible by 3 then Hip, divisible by 5, then Hop, and if it's divisible by both 3 and 5, then it prints Whazaa)
View frequency_db.rb
# assuming the file is there in the same dir as numbers.txt
file ="numbers.txt", 'r')
frequency_db =
file.each_line do |line|
line_n = line.split
line_n.each do |n|
if frequency_db.has_key?(n)