Skip to content

Instantly share code, notes, and snippets.

View tovbinm's full-sized avatar
⌨️
<typing sounds>

Matthew Tovbin tovbinm

⌨️
<typing sounds>
View GitHub Profile
@tovbinm
tovbinm / gist:1904702
Created February 24, 2012 23:54
Making use of PageDown/PageUp/Home/End keys in Max OS X terminal
1. Open Mac OS x terminal
2. Go to Preferences -> Settings -> Keyboard
3. Redefine keys to "Send string to shell" as follows:
Key Escape Sequence
Home \033[1~
End \033[4~
Page Up \033[5~
Page Down \033[6~
@tovbinm
tovbinm / gist:1935634
Created February 28, 2012 22:18
Get ec2 instance FQDN
ec2hm=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`; echo ec2-${ec2hm//./-}.compute-1.amazonaws.com; unset ec2hm
var c = require('riak-js').getClient({ host: 'hostname', port: 8098 });
var mr = c.add('bucket').map(function m(v){return [1]}).reduce(function(v) { return [v.reduce(function(t, val) { return t + val; }, 0)]});
mr.run({timeout: 10000000});
ADD JAR s3://<s3-bucket>/jars/hive_contrib-0.5.jar;
CREATE TEMPORARY FUNCTION now as 'com.mt.utils.udf.Now';
CREATE TEMPORARY FUNCTION user_agent_f as 'com.mt.utils.UserAgent';
set hive.merge.mapredfiles=true;
set hive.merge.mapfiles=true;
set hive.merge.size.per.task=500000000;
CREATE EXTERNAL TABLE data
#!/bin/bash
apt-get -y update
apt-get -y install mdadm
echo "y" | mdadm --create /dev/md0 --level 0 --raid-devices 2 /dev/xvdb /dev/xvdc
echo "DEVICE /dev/xvdb /dev/xvdc" > /etc/mdadm/mdadm.conf
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
blockdev --setra 65536 /dev/md0
mkfs.ext3 -F /dev/md0
mkdir -p /mnt/dataraid && mount -t ext3 /dev/md0 /mnt/dataraid -o noatime
echo "/dev/md0 /mnt/dataraid ext3 noatime 0 0" | tee -a /etc/fstab
@tovbinm
tovbinm / hack.sh
Created April 9, 2012 19:18 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@tovbinm
tovbinm / gist:2407636
Created April 17, 2012 17:28
Install s3cmd
wget -O s3c.zip http://goo.gl/skBTi && unzip s3c.zip && cd ./s3cmd-1.1.0-beta3 && python setup.py install && cd ../ && rm -rf ./s3c.zip ./s3cmd-1.1.0-beta3
@tovbinm
tovbinm / gist:2407992
Created April 17, 2012 18:24
Syntax highlighting in VIM
echo "syntax on" >> ~/.vimrc
@tovbinm
tovbinm / install_riak_with_homebrew.bash
Created May 2, 2012 21:43 — forked from tinomen/install_riak_with_homebrew.bash
riak needs erlang R13b04 and homebrew now defaults to R14
# first install erlang using the R13b04 formula
brew install https://github.com/mxcl/homebrew/raw/810d52f4a386ea9e2b837030120ffd69cad73722/Library/Formula/erlang.rb
# now you are free to install riak
brew install riak
@tovbinm
tovbinm / Command line
Created May 4, 2012 21:39
Modify hosts file on Android device
adb remount
adb push ~/android.hosts /system/etc/hosts