Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from random import randint
from operator import add
times = 10
# Step 1: Rooling dice and record result into array
genseq = map (lambda _: randint(1,6) , [i for i in range(times)] )
#Steap 2: Count occurances
# bmap : map a number into bitmap array, eg: 2 -> [0,1,0,0,0,0](one hot encoding)
@max6cn
max6cn / git-tricks.md
Created May 1, 2015 22:49
Git tricks

Viewing all git diffs with vimdiff

git config --global diff.tool vimdiff
git config --global difftool.prompt false
git config --global alias.d difftool
@max6cn
max6cn / gcj.css
Created April 21, 2015 23:36
Stylish Yellow Theme For GCJ
body {
background-color: #fdf6e3;
color: black;
font-family: 'Source Serif Pro',Arial, sans-serif;
font-size: 18px;
line-height: 140%;
text-shadow: 0px 1px 1px #fff;
}
h3 { font-size: 180%;
@max6cn
max6cn / custom.css
Created April 21, 2015 23:06
CSS For Better Rust Doc Reading(Maybe other site too)
body {
font-family: 'Source Serif Pro','Lucida Grande', 'Lucida Sans Unicode', 'Geneva',
'Verdana', sans-serif;
font-size: 18px;
background-color: #fdf6e3;
line-height: 140%;
}
#page-wrapper {
background-color: #fdf6e3;
@max6cn
max6cn / Spark.md
Last active October 12, 2015 00:07
Install Hadoop & Hive & iPython & Spark

1. Hadoop

  • Install (Comming Soon!)

  • Configuration(Comming Soon!)

  • Test Hadoop Installation

yarn jar $YARN_EXAMPLES/hadoop-mapreduce-examples-2.5.0.jar pi 80 100000000

2. iPython

@max6cn
max6cn / Linux-Cheat-Sheet.md
Last active August 29, 2015 14:18
Useful Linux Commands

Decompress a bzip file

bzip2 -d ../enwiki-20150304-pages-articles-multistream.xml.bz2
## takes about 30min
pv ../enwiki-20150304-pages-articles-multistream.xml.bz2 |pbunzip2 > enwiki.xml

takes 3 min(12 core)

@max6cn
max6cn / Demo.md
Last active August 29, 2015 14:18

Demo A. Text Search ( Introdution to programming and parallel computing)

Summary:

Search keywords in a text file

Tools used:

Hadoop(hdfs), Apache Spark, gcc

Language:

C,Shell Script, Python

Task I : Searching keywords in file and counting its frequency

  • Oldschool / Standard way Link

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname