Skip to content

Instantly share code, notes, and snippets.

View jvkumar's full-sized avatar

Jai Kumar jvkumar

  • San Francisco bay area, CA
View GitHub Profile
#!/bin/sh
#
# 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/nginx.pid
@jvkumar
jvkumar / slug_error
Created August 18, 2012 19:45
Mongoid_slug is not installed
I have gem mongoid (3.0.4, 3.0.1)
My Gemfile looks like:
----------------------
source 'https://rubygems.org'
gem 'rails', '3.2.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@jvkumar
jvkumar / gfile
Created August 19, 2012 07:47
gemfiles
My Gemfile
----------
source 'https://rubygems.org'
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'
@jvkumar
jvkumar / mkf
Created August 19, 2012 23:05
All info
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
jvkumar / postcard.go
Created September 14, 2012 23:33
Image postcard
Today is my second day of golang learning. I have gone through all the exercises of go tutorial on http://tour.golang.org/ 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
jvkumar / date.rb
Created October 9, 2012 23:47
date monkey patching
require 'date'
class Date
class << self
alias_method :original_parse, :parse
end
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'
end
self.original_parse(str, comp, start)
@jvkumar
jvkumar / hook.sh
Created October 10, 2012 22:01
github hook
On Mac OS (or, likely, any BSD), the sed command parameters have to be slightly different. Try this:
#!/bin/sh
if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@jvkumar
jvkumar / api.json
Created October 23, 2012 18:43
Packagedb
GET /packages/latest?os=windows
-------------------------------
[{
"required": "1.0.0.80",
"product": "thoragent",
"target": "testing",
"os": "windows",
"id": 327,
"requiredurl": "http://com.memeo.magni.dl.s3.amazonaws.com/thoragent/MemeoC1Agent-1.0.0.80.zip",
@jvkumar
jvkumar / schema.jason
Created November 27, 2012 18:46
email template
template {
id: hash of (name,country,text,language,unixtimestamp)
name:
text:
html:
subject:
description:
country:
language:
is_active:
@jvkumar
jvkumar / comt
Created December 3, 2012 19:39
cmt
Jais-MacBook-Pro:bifrost jai$ git log
commit 8b84f41f52fb4e4c77d559b734af1a4ef825262d
Author: Jai Kumar <jai.kumar@memeo-inc.com>
Date: Mon Dec 3 11:29:30 2012 -0800
added orgid in id hash building
commit 3d2fbed2303d5015d1bbcf34ba4c3f64b60cfdf4
Author: Jai Kumar <jai.kumar@memeo-inc.com>
Date: Mon Dec 3 11:12:18 2012 -0800