This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
if [[ $# != 1 ]]; then | |
cat - << USAGE | |
Usage: `basename $0` <branch> | |
USAGE | |
return 1 | |
fi | |
local old_branch=$(git rev-parse --abbrev-ref HEAD) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git log --all --since=midnight --author="$USER" $* --format='%d' --numstat \ | |
| awk -f <(cat <<- 'SCRIPT' | |
/\(/ { NB=NB+1 ; next } | |
NF==3 { ADD=ADD+$1; DEL=DEL+$2; NC=NC+1 } | |
END { printf "+%d, -%d in %d commit(s), %d branch(es)\n", ADD, DEL, NC, NB } | |
SCRIPT) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib, urllib2, json | |
''' | |
The ``FacebookTestUserManager`` module | |
====================================== | |
Author: Weizhong Yang <zonble at gmail dot com> | |
A tool which helps to create and delete test account for Facebook. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global alias.link '!f() { echo https://$(git config --get remote.origin.url | sed s/^[[:alpha:]]*@// | sed s/:/\\// | sed s/\\.git$//)/commit/$(git rev-parse ${1:-HEAD}); }; f' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typeset -gaU preexec_functions | |
typeset -gaU precmd_functions | |
preexec_functions+='preexec_start_timer' | |
precmd_functions+='precmd_report_time' | |
_tr_current_cmd="?" | |
_tr_sec_begin="${SECONDS}" | |
_tr_ignored="yes" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export FMC_WRAPPER=`basename $0` | |
MERGE_COMMIT=`git find-merge-commit $*` | |
if [[ $? != 0 ]]; then | |
exit $? | |
fi | |
git branch --all --contain $MERGE_COMMIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type ( | |
tF func(int) int | |
tRF func(tF) tF | |
tX func(tX) tF | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
WEBRTC_REPO=http://webrtc.googlecode.com/svn/trunk | |
WEBRTC_REV=7217 | |
svn checkout ${WEBRTC_REPO}/talk/app/webrtc/java@r${WEBRTC_REV} peer_connection | |
svn checkout ${WEBRTC_REPO}/webrtc/modules/audio_device/android/java@r${WEBRTC_REV} audio_device | |
svn checkout ${WEBRTC_REPO}/webrtc/modules/video_capture/android/java@r${WEBRTC_REV} video_capture | |
svn checkout ${WEBRTC_REPO}/webrtc/modules/video_render/android/java@r${WEBRTC_REV} video_render |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generic template | |
template <typename T> | |
struct Foo { | |
static int bar(const T& t) { return -1; } | |
}; | |
// Specialization | |
class C; | |
template<> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T> | |
struct Accumulator { | |
Accumulator(T n) : n_{n} {} | |
template <typename U> | |
const T& operator()(const U& i) { return n_ += i; } | |
private: | |
T n_; | |
}; | |
template <typename T> |