Skip to content

Instantly share code, notes, and snippets.

View tomzhang's full-sized avatar
🏠
Working from home

mingfeng.zhang tomzhang

🏠
Working from home
  • beijing china
View GitHub Profile
/**
* MultiSig.sol v1.0.0
*
* Bilal Arif - https://twitter.com/furusiyya_
* Block360
*/
pragma solidity 0.4.18;
@tomzhang
tomzhang / gunicorn_service.py
Created May 17, 2017 01:05 — forked from TheWaWaR/gunicorn_service.py
Gunicorn service script {Start | Restart | Stop | Reload | Quit}
#!/usr/bin/env python
#coding: utf-8
import os
import imp
import time
import signal
import argparse
import commands
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
@tomzhang
tomzhang / ipsec-shadowsocks.sh
Created November 12, 2016 06:08 — forked from jolestar/ipsec-shadowsocks.sh
Run ipsec vpn and shadowsocks by docker, for ubuntu 16
PASSWORD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
apt-get update
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" | sudo tee /etc/apt/sources.list.d/docker.list
apt-get update
apt-get install -y docker-engine
service docker start
@tomzhang
tomzhang / Naive-VPN.md
Created August 5, 2016 08:51 — forked from klzgrad/Naive-VPN.md
朴素VPN:一个纯内核级静态隧道

朴素VPN:一个纯内核级静态隧道

由于路由管控系统的建立,实时动态黑洞路由已成为最有效的封锁手段,TCP连接重置和DNS污染成为次要手段,利用漏洞的穿墙方法已不再具有普遍意义。对此应对方法是多样化协议的VPN来抵抗识别。这里介绍一种太简单、有时很朴素的“穷人VPN”。

朴素VPN只需要一次内核配置(Linux内核),即可永久稳定运行,不需要任何用户态守护进程。所有流量转换和加密全部由内核完成,原生性能,开销几乎没有。静态配置,避免动态握手和参数协商产生指纹特征导致被识别。并且支持NAT,移动的内网用户可以使用此方法。支持广泛,基于L2TPv3标准,Linux内核3.2+都有支持,其他操作系统原则上也能支持。但有两个局限:需要root权限;一个隧道只支持一个用户。

朴素VPN利用UDP封装的静态L2TP隧道实现VPN,内核XFRM实现静态IPsec。实际上IP-in-IP隧道即可实现VPN,但是这种协议无法穿越NAT,因此必须利用UDP封装。内核3.18将支持Foo-over-UDP,在UDP里面直接封装IP,与静态的L2TP-over-UDP很类似。

创建一个朴素VPN

@tomzhang
tomzhang / StanfordCoreNLPServerMultiLang.java
Created July 10, 2016 11:45 — forked from rudaoshi/StanfordCoreNLPServerMultiLang.java
Stanford Core NLP Server 模式的多语言版本。
package edu.stanford.nlp.pipeline;
import com.sun.net.httpserver.*;
import edu.stanford.nlp.io.IOUtils;
import edu.stanford.nlp.io.RuntimeIOException;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
import edu.stanford.nlp.ling.IndexedWord;
import edu.stanford.nlp.ling.tokensregex.SequenceMatchResult;
import edu.stanford.nlp.ling.tokensregex.TokenSequenceMatcher;
@tomzhang
tomzhang / go1.4arc65-ubuntu.sh
Last active August 29, 2015 14:27 — forked from einthusan/go1.4arc65-ubuntu.sh
Install Golang 1.4.1 on Ubuntu 14.04 AWS EC2
#!/bin/sh
# OPTIONAL FLAGS:
#
# -geoip true
# this will install maxmind geoip and auto update crontab file
#
# -cloudwatch true
# this will install aws cloud watch metrics and send them to aws dashboard
#
$ wget http://tengine.taobao.org/download/tengine-1.3.0.tar.gz
$ wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.0.1.tar.gz
$ wget http://gperftools.googlecode.com/files/gperftools-2.0.tar.gz
$ tar zxvf libunwind-1.0.1.tar.gz && cd libunwind-1.0.1
$ CFLAGS=-fPIC ./configure
$ make CFLAGS=-fPIC
$ sudo make CFLAGS=-fPIC install
$ cd ..
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
# Install stuff #
#################
# Install development tools and some misc. necessary packages
yum -y groupinstall "Development tools"
yum -y install zlib-devel # gen'l reqs