Skip to content

Instantly share code, notes, and snippets.

Alfred Zhou adaiguoguo

Block or report user

Report or block adaiguoguo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dalang /
Created May 11, 2015
print yanghui triangle
def yanghui_triangle():
def safe_get_value(l, index):
length = len(l)
return 0<= index < length and l[index] or 0
tmp = [1]
while True:
yield tmp
length = len(tmp)
new = []
View pyenv on CentOS6.5
# KISS Install and use pyenv on CentOS 6.5 (final)
# pyenv =>
# As root
cd ~
git clone git:// .pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
# copy from
function extract() # Handy Extract Program
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
adaiguoguo /
Last active Jun 8, 2016 — forked from liaoyw/
# copy from
function extract() # Handy Extract Program
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
westwickfarrow /
Created Jul 13, 2012
Install ElasticSearch on Ubuntu 12.04
cd ~
sudo add-apt-repository ppa:dlecan/openjdk
sudo apt-get update
sudo apt-get install openjdk-7-jre -y
wget -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
massenz / README.rst
Last active Aug 8, 2017
Apache Mesos build and install scripts; optionally runs the Master/Slave locally and executes a demo (C++) framework against it, to validate it all went according to plan
View README.rst

Apache Mesos Build scripts

The `Getting started`_ instructions are a good start (no surprise there!) but are somewhat incomplete and currently look a bit outdated (I plan to fix them soon): however, the outcome has been that I have struggled more than I felt necessary in building and running Mesos on a dev VM (Ubuntu 14.04 running under VirtualBox).

Some of the issue seem to arise from the unfortunate combination of Mesos Master trying to guess its own IP address, the VM being (obviously) non-DNS resolvable and, eventually, the Slave and the Framework failing to properly communicate with the Master.

In the process of solving this, I ended up automating all the dependencies installation, building and running the framework; I have then broken it down into the following modules to make it easier to run only parts of the process.


Install pandoc on Mac OS X 10.8


Install haskell-platform

$ brew install haskell-platform
ambakshi /
Last active Jul 19, 2018
set -e
## striping seems to break docker
#STRIPE="-i2 -I64"
#DEVS="/dev/xvdf /dev/xvdg"
if [ -z "$DEVS" ]; then
echo >&2 "Specify which block devices to use"
exit 1


Gitlab是目前比较流行的开源类Github代码管理平台。Gitlab使用Rails开发,使用PostgreSQL或MySQL数据库,Redis做缓存。一般自己搭建私有代码仓库,Gitlab通常是首选。这里简单介绍一下dockerized Gitlab。



这里以Ubuntu 14.04发行版为例,在bash中输入一下命令安装最新的docker:

border / Makefile
Created Jan 12, 2011
json example in golang
View Makefile
include $(GOROOT)/src/
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
$(GOFMT) -w jsontest.go
You can’t perform that action at this time.