Skip to content

Instantly share code, notes, and snippets.

Mac Homebrew (RVM/MySQL/Redis) setup

Follow the steps below to setup a local development environment:

XQuartz

Recommended to download latest XQuartz

iTerm2

@code6
code6 / Test.java
Last active August 29, 2015 14:08 — forked from nogweii/Test.java
import javax.crypto.Cipher;
class Test {
public static void main(String[] args) {
try {
System.out.println("Hello World!");
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
System.out.println(maxKeyLen);
} catch (Exception e){
System.out.println("Sad world :(");
@code6
code6 / gen.sh
Created June 13, 2014 09:44
mdrill.task.assignment generate script
python gen_task_assignment_conf.py -m 10 -s 60 --hosts $hosts --ports $ports
@code6
code6 / calc.py
Created November 16, 2013 08:21
quick and dirty calc.py
#coding=utf8
read_ints = lambda: map(int, raw_input().split())
#先假设没有正负号
# 1 + (12 + 4)
# 提高, 有正负号怎么办呢?
#((1+2)*(-333+4)+1) * (-5)
# 1 * -5
@code6
code6 / remove last 6 char
Created September 26, 2013 10:18
vim tips
http://stackoverflow.com/questions/11409518/how-to-remove-last-6-characters-of-every-line-in-vim
#http://mapredit.blogspot.com/2013/05/get-all-extended-hive-tables-with.html
for file in $(hive -e "show table extended like \`*\`" | grep location: | awk 'BEGIN { FS = ":" };{printf("hdfs:%s:%s\n",$3,$4)}'); do hdfs dfs -du -h $file; done;
@code6
code6 / array
Last active December 22, 2015 02:39
bash note
#http://stackoverflow.com/questions/15105135/bash-capturing-output-of-awk-into-array
lists=("http://www.youtube.com/watch?v=tKTZoB2Vjuk"
"http://www.youtube.com/watch?v=EPYupizJYQI"
"http://www.youtube.com/watch?v=haycL41dAhg"
"http://www.youtube.com/watch?v=kWyoYtvJpe4"
"http://www.youtube.com/watch?v=uKZ8GBKmeDM"
"http://www.youtube.com/watch?v=Nn2KQmVF5Og"
"http://www.youtube.com/watch?v=IcteAbMC1Ok");
@code6
code6 / gsh
Created August 27, 2013 07:12
control multiple host using gsh
gsh --hosts-file=hosts
@code6
code6 / importer
Last active December 21, 2015 17:08
python recipe
import os
import imp
WORKDIR = os.path.dirname(os.path.abspath(__file__))
path = lambda *a: os.path.join(WORKDIR, *a)
importer = lambda m, path: imp.load_module(m, *imp.find_module(m, [path]))
env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10