Skip to content

Instantly share code, notes, and snippets.

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@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
@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 / 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 / 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 / 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 / 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
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)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@max6cn
max6cn / jquery.iframe_to_div.js
Created March 19, 2016 05:44 — forked from aklump/jquery.iframe_to_div.js
A jQuery plugin to replace iframes with divs containing their source by loading via ajax. Benefits use parent page's css and have an auto height to your iframe.
/**
* Convert iframes to divs via ajax iframe_to_div jQuery Plugin
*
* Uses javascript to replace iframes with divs containing their source content
* by loading via ajax. If you use this to load vanilla html snippets, this has the
* effect of applying the page's css to your vanilla html snippet.
*
* This will not work if the iframe src is not a relative link due to ajax restrictions across domains.
*
* As an example: