Skip to content

Instantly share code, notes, and snippets.

> tree
.
├── ext
│   ├── cli.sh
│   ├── debug.sh
│   ├── help.sh
│   ├── hiveserver.sh
│   ├── hwi.sh
│   ├── jar.sh
│   ├── lineage.sh
@aaronfeng
aaronfeng / gist:2882234
Created June 6, 2012 14:30
hive insert overwrite directory
INSERT OVERWRITE DIRECTORY '${OUTPUT_BUCKET}/results/report/region=${REGION}/dt=${DATE}'
SELECT
dt,
col1,
col2,
col3,
col4,
col5,
col6,
avg(col7) col7,
@aaronfeng
aaronfeng / gist:2314705
Created April 5, 2012 22:32
first cloud foundry app
Would you like to deploy from the current directory? [Yn]: Y
Application Name: testapp
Detected a Rails Application, is this correct? [Yn]: Y
Memory Reservation (64M, 128M, 256M, 512M, 1G, 2G) [256M]: 64M
Creating Application: OK
Would you like to bind any services to 'testapp'? [yN]: y
The following system services are available
1: mysql
Please select one you wish to provision: 1
Specify the name of the service [mysql-4f8ad]:
> ec2-describe-instances i-b06671d4
RESERVATION r-0de6606e 444992366026 jenkins
INSTANCE i-b06671d4 ami-df25fbb6 ec2-107-22-153-110.compute-1.amazonaws.com domU-12-31-38-01-BA-E3.compute-1.internal running riot-laptop 0 m1.small 2012-03-30T15:00:30+0000 us-east-1a aki-88aa75e1 monitoring-disabled 107.22.153.110 10.253.189.13 instance-store paravirtual xen sg-7c440e15 default
TAG instance i-b06671d4 Name
@aaronfeng
aaronfeng / gist:2252163
Created March 30, 2012 15:07
centos 6.2 AMI pv-grub
Xen Minimal OS!
start_info: 0xce2000(VA)
nr_pages: 0x6a400
shared_inf: 0xb85b9000(MA)
pt_base: 0xce5000(VA)
nr_pt_frames: 0xb
mfn_list: 0x990000(VA)
mod_start: 0x0(VA)
mod_len: 0
flags: 0x0
@aaronfeng
aaronfeng / gist:2007838
Created March 9, 2012 18:14
hbase scan root
hbase(main):003:0> scan '-ROOT-'
ROW COLUMN+CELL
.META.,,1 column=info:server, timestamp=1331294048767, value=localhost:43419
.META.,,1 column=info:serverstartcode, timestamp=1331294048767, value=1331294040049
1 row(s) in 0.0120 seconds
@aaronfeng
aaronfeng / gist:2007817
Created March 9, 2012 18:07
hbase create table error
Type "exit<RETURN>" to leave the HBase Shell
Version 0.92.0-cdh4b1, rUnknown, Fri Feb 10 17:42:51 PST 2012
hbase(main):001:0> create 'foo', 'bar'
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/lib/hbase/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/lib/zookeeper/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
ERROR: org.apache.hadoop.hbase.client.RetriesExhaustedException: Failed after attempts=7, exceptions:
@aaronfeng
aaronfeng / euler22.awk
Created August 13, 2011 04:36
project euler #22
# http://projecteuler.net/index.php?section=problems&id=22
BEGIN {RS=",";}
{
gsub(/"/, "", $1);
names[NR] = $1
}
END {
@aaronfeng
aaronfeng / rescue_fun.rb
Created June 14, 2011 16:20
Random rescue trivia
# before running the program, do you know what is the output?
begin
begin
raise Exception.new
rescue
puts "Inner Exception"
end
rescue Exception
puts "Outter Exception!"
@aaronfeng
aaronfeng / cd_into_method_error.pry
Created May 29, 2011 22:14
pry cd into method error
pry(main)> cd PeopleController
pry(PeopleController):1> ls -M
[:create, :destroy, :edit, :index, :new, :show, :update]
pry(PeopleController):1> cd method(:show)
NameError: undefined method `show' for class `Class'
from /Users/afeng/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.8.3/lib/pry/commands.rb:734:in `eval'
pry(PeopleController):1> cd method(show)
NameError: undefined local variable or method `show' for PeopleController:Class
from /Users/afeng/.rvm/gems/ruby-1.9.2-p180/gems/pry-0.8.3/lib/pry/commands.rb:734:in `eval'
pry(PeopleController):1> cd method('show')