Skip to content

Instantly share code, notes, and snippets.

View ee08b397's full-sized avatar
🎾

Songxiao Zhang ee08b397

🎾
  • BlackRock
  • New York, New York
  • 15:43 (UTC -04:00)
View GitHub Profile
@ee08b397
ee08b397 / tmux.md
Last active August 29, 2015 14:23 — forked from andreyvit/tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@ee08b397
ee08b397 / tree.md
Last active August 29, 2015 14:23 — forked from hrldcpr/tree.md

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@ee08b397
ee08b397 / GIF-Screencast-OSX.md
Last active August 29, 2015 14:26 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@ee08b397
ee08b397 / defaultData.csv
Last active August 29, 2015 14:26 — forked from phil-pedruco/defaultData.csv
3D Scatter Plot Using three.js
x y z lp_x lp_y lp_z hp_x hp_y hp_z
0.235458 -0.597702 -0.724487 0.232433 -0.593757 -0.717156 0.003025 -0.003945 -0.007332
0.235458 -0.597702 -0.724487 0.232735 -0.594152 -0.717889 0.002723 -0.003550 -0.006598
0.217346 -0.597702 -0.724487 0.231197 -0.594507 -0.718549 -0.013850 -0.003195 -0.005939
0.217346 -0.579590 -0.724487 0.229812 -0.593015 -0.719143 -0.012465 0.013425 -0.005345
0.199234 -0.579590 -0.724487 0.226754 -0.591673 -0.719677 -0.027520 0.012083 -0.004810
0.199234 -0.597702 -0.760712 0.224002 -0.592276 -0.723781 -0.024768 -0.005426 -0.036931
0.163010 -0.579590 -0.706375 0.217903 -0.591007 -0.722040 -0.054893 0.011417 0.015665
0.108673 -0.597702 -0.724487 0.206980 -0.591676 -0.722285 -0.098307 -0.006026 -0.002203
0.090561 -0.615814 -0.724487 0.195338 -0.594090 -0.722505 -0.104777 -0.021724 -0.001982
@ee08b397
ee08b397 / git-recover-branch.md
Last active August 29, 2015 14:27 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@ee08b397
ee08b397 / gist:590b6f179690d05b07af
Created December 9, 2015 19:00 — forked from sontek/gist:af82d281e618074ca8a6
Cassandra benchmark
import time
import uuid
import yappi
import timeit
import logging
import random
from threading import Event
from cassandra import ConsistencyLevel
from cassandra.cluster import Cluster
@ee08b397
ee08b397 / Spark-SingleRDDfrmMultipleFiles
Created January 20, 2016 17:10 — forked from mkanchwala/Spark-SingleRDDfrmMultipleFiles
Spark : How to create a Single RDD from Multiple Files
Best way to create Mutliple files into a single RDD
==================================
val fileRDD = sc.textFile(filename).repartition(1)
Where the filename is the location of your directory only.
@ee08b397
ee08b397 / Kafka MultiNode - MultiBroker Cluster.md
Created January 20, 2016 17:10 — forked from mkanchwala/Kafka MultiNode - MultiBroker Cluster.md
Create Kafka Multi Node, Multi Broker Cluster

Setting up Flume NG, listening to syslog over UDP, with an S3 Sink

My goal was to set up Flume on my web instances, and write all events into s3, so I could easily use other tools like Amazon Elastic Map Reduce, and Amazon Red Shift.

I didn't want to have to deal with log rotation myself, so I setup Flume to read from a syslog UDP source. In this case, Flume NG acts as a syslog server, so as long as Flume is running, my web application can simply write to it in syslog format on the specified port. Most languages have plugins for this.

At the time of this writing, I've been able to get Flume NG up and running on 3 ec2 instances, and all writing to the same bucket.

Install Flume NG on instances

@ee08b397
ee08b397 / ncdc.sh
Created February 2, 2016 00:27 — forked from aligusnet/ncdc.sh
Download a weather dataset from the National Climatic Data Center (NCDC, http://www .ncdc.noaa.gov/). Prepare it for examples of "Hadoop: The Definitive Guide" book by Tom White. http://www.amazon.com/Hadoop-Definitive-Guide-Tom-White/dp/1449311520 Usage: ./ncdc.sh 1901 1930 # download wheather datasets for period from 1901 to 1930.
#!/usr/bin/env bash
# global parameters
g_tmp_folder="ncdc_tmp";
g_output_folder="ncdc_data";
g_remote_host="ftp3.ncdc.noaa.gov";
g_remote_path="pub/data/noaa";