Skip to content

Instantly share code, notes, and snippets.

source :rubygems
gem 'sinatra', '1.0'
gem 'oauth2'
gem 'json'
group :development do
gem 'shotgun'
end
# crappy server implementation using technoweenie/oauth2 (server branch)
# http://github.com/technoweenie/oauth2/compare/master...server
#
# ruby oauth2_example.rb -p 4568
# ruby oauth2_example.rb
# open http://localhost:4567/auth/facebook
require 'rubygems'
require 'sinatra'
require 'oauth2/client'
select
*
from
(
select pav1.value make1, pav2.value year1, pav3.value model1, pav4.value style1,
(select value from vehicle_source.product_attribute_value where product_id=p4.product_id and attribute_id=4) ed_style_id,
(select value from vehicle_source.product_attribute_value where product_id=p3.product_id and attribute_id=3) ed_model_id,
(select value from vehicle_source.product_attribute_value where product_id=p4.product_id and attribute_id=(select attribute_id from vehicle_source.attribute where lower(trim(attribute_name))='trim level')) trim_level,
(select value from vehicle_source.product_attribute_value where product_id=p4.product_id and attribute_id=(select attribute_id from vehicle_source.attribute where lower(trim(attribute_name))='style start date')) style_start_date,
@noomerikal
noomerikal / db.rb
Created February 27, 2011 09:36 — forked from alg/db.rb
namespace :db do
desc 'Seed database from db/seed.sql file instead of the traditional db/seed.rb'
namespace :seed do
config = Rails::Configuration.new.database_configuration[RAILS_ENV]
seed_sql = File.expand_path(File.dirname(__FILE__) + '/../../db/seed.sql')
if !File.exists?(seed_sql)
puts "Missing RAILS_ROOT/db/seed.sql"
require 'terminal-table/import'
class SubsetSumMatrix
class << self
def create_empty_for(array)
matrix = []
header = [nil] + build_header_from(array)
matrix << header
array.each_with_index do |element,i|
row = header.collect{|value| 'F'}
@noomerikal
noomerikal / compile.m
Created April 10, 2011 19:45
Changes to TLD compile.m for mac os x.
% Compiles mex files.
clc; clear all; cd mex;
% edit based on your installation folder
include = ' -I/Users/bneale/homebrew/Cellar/opencv/2.2/include/opencv -I/Users/bneale/homebrew/Cellar/opencv/2.2/include';
lib = ' -L/Users/bneale/homebrew/Cellar/opencv/2.2/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann';
% =========================================================================
eval(['mex lk.cpp -O' include lib]);
#!/bin/bash -e
# 2010-09-19 Marc Limotte
# Run continuously (every 30 minutes) as a cron.
#
# Looks for directories in HDFS matching a certain pattern and moves them to S3, using Amazon's new
# distcp replacement, S3DistCp.
#
# It creates marker files (_directory_.done and _directory_.processing) at the S3 destination, so
@noomerikal
noomerikal / tired.rb
Created May 17, 2011 07:53 — forked from karmi/tired.rb
Template for generating a no-frills Rails application with support for ElasticSearch full-text search via the Tire gem
# ===================================================================================================================
# Template for generating a no-frills Rails application with support for ElasticSearch full-text search via Tire
# ===================================================================================================================
#
# This file creates a basic, fully working Rails application with support for ElasticSearch full-text search
# via the Tire gem [http://github.com/karmi/tire].
#
# You DON'T NEED ELASTICSEARCH INSTALLED, it is installed and launched automatically by this script.
#
# Requirements
@noomerikal
noomerikal / bookmarklet.js
Created June 12, 2011 10:26 — forked from kn0ll/bookmarklet.js
advanced bookmarklet template
javascript:(function() {
if(!window.your_bookmarklet) {
var doc = document,
js = doc.createElement('script');
js.type = 'text/javascript';
js.src = 'loader.js';
js.async = true;
@noomerikal
noomerikal / Mapper.java
Created June 15, 2011 20:17
HDFS stack trace - MultipleOutputs + TableMapper
import com.edmunds.lead.thrift.gen.Address;
import com.edmunds.lead.thrift.gen.Contract;
import com.edmunds.lead.thrift.gen.Customer;
import com.edmunds.lead.thrift.gen.Lead;
import com.edmunds.lead.thrift.gen.Option;
import com.edmunds.lead.thrift.gen.Phone;
import com.edmunds.lead.thrift.gen.Subscription;
import com.edmunds.lead.thrift.gen.Tracking;
import com.edmunds.lead.thrift.gen.Vehicle;
import org.apache.hadoop.hbase.client.Result;