Skip to content

Instantly share code, notes, and snippets.

View ee08b397's full-sized avatar
🎾

Songxiao Zhang ee08b397

🎾
  • BlackRock
  • New York, New York
  • 22:04 (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!

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
xs = [10, 20]
ys = [1250.0, 250.0]
zs = [1, 2]
fig = plt.figure()
ax = fig.add_subplot(111, projection = '3d')
from mpl_toolkits.mplot3d import Axes3D
import mpl_toolkits.mplot3d.art3d as art3d
fig = plt.figure()
ax=fig.gca(projection='3d')
for i in ["x","y","z"]:
circle = Circle((0, 0), 1)
circle.set_clip_box(ax.bbox)
@ee08b397
ee08b397 / ancestor.pl
Last active August 29, 2015 14:26
execution order does matter for prolog, top-down; ancestor22 can cause infinite recursion
/*
a
/ \
b d
|
c
|
e
*/
@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
#!/bin/bash
# http://jcornuz.wordpress.com/2007/10/10/workflow-3-quick-raw-converting-batch/
# processes raw files
for f in *.CR2;
do
echo "Processing $f"
ufraw-batch \
--wb=camera \
--out-type=jpeg \
@ee08b397
ee08b397 / ObjPass.java
Created September 21, 2015 16:52
Java call-by-value, pass arrays/autoboxing
import java.util.LinkedList;
import java.util.ListIterator;
public class ObjPass {
public static void change_int(Integer i) {
i = 1000;
}
public static void change_string(String a) {
a = "changed";