Skip to content

Instantly share code, notes, and snippets.


Jai Kumar jvkumar

  • San Francisco bay area, CA
View GitHub Profile
View nginx
# nginx - this script starts and stops the nginx daemin
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/
jvkumar / slug_error
Created Aug 18, 2012
Mongoid_slug is not installed
View slug_error
I have gem mongoid (3.0.4, 3.0.1)
My Gemfile looks like:
source ''
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://'
View gfile
My Gemfile
source ''
gem 'rails', '3.2.6'
gem "mongoid", "~> 3.0.0"
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'execjs'
View mkf
Model: posts.rb
class Post
include Mongoid::Document
include Mongoid::Slug
field :name, type: String
field :title, type: String
field :content, type: String
validates :title, :presence => true, :length => { :minimum => 10 }
jvkumar / postcard.go
Created Sep 14, 2012
Image postcard
View postcard.go
Today is my second day of golang learning. I have gone through all the exercises of go tutorial on and I am trying to write a simple program to overlap one image on another. My goal is to have an image (called background image) and then paste two images on top of it with given x, y, and z axis value with some angle (rotation).
I have skeleton of my first golang code below. I am freaking out as how to proceed. Any help or example of code will be greatly appreciated.
package main
func main() {
//ASSUMPTION: All images will be jpg and much smaller compare to background image and they will never go outside the background image
jvkumar / date.rb
Created Oct 9, 2012
date monkey patching
View date.rb
require 'date'
class Date
class << self
alias_method :original_parse, :parse
def self.parse(str='-4712-01-01', comp=true,start=ITALY)
if str == '0000-00-00 00:00:00'
str = '1970-01-01 00:00:00'
self.original_parse(str, comp, start)
jvkumar /
Created Oct 10, 2012
github hook
On Mac OS (or, likely, any BSD), the sed command parameters have to be slightly different. Try this:
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
# Initial commit: diff against an empty tree object
View api.json
GET /packages/latest?os=windows
"required": "",
"product": "thoragent",
"target": "testing",
"os": "windows",
"id": 327,
"requiredurl": "",
View schema.jason
template {
id: hash of (name,country,text,language,unixtimestamp)
View comt
Jais-MacBook-Pro:bifrost jai$ git log
commit 8b84f41f52fb4e4c77d559b734af1a4ef825262d
Author: Jai Kumar <>
Date: Mon Dec 3 11:29:30 2012 -0800
added orgid in id hash building
commit 3d2fbed2303d5015d1bbcf34ba4c3f64b60cfdf4
Author: Jai Kumar <>
Date: Mon Dec 3 11:12:18 2012 -0800