Skip to content

Instantly share code, notes, and snippets.

View liushuaikobe's full-sized avatar

Shuai Liu liushuaikobe

  • Alibaba
  • Hangzhou, China
  • 20:25 (UTC +08:00)
View GitHub Profile
import gevent.monkey
gevent.monkey.patch_all()
import time
import pymongo
connection = pymongo.Connection(use_greenlets=True)
def task():
collection = connection.autoref.all_cars
@liushuaikobe
liushuaikobe / easy-config-Ubuntu.sh
Last active December 25, 2015 06:49
Run when Ubuntu was installed on some PC.
sudo apt-get install make
sudo apt-get install tree
sudo apt-get install unzip
sudo apt-get install htop
sudo apt-get install ntp
sudo apt-get install g++
sudo apt-get install libssl-dev
sudo apt-get install apache2
sudo apt-get install git-core
git config --global user.name liushuaikobe
@liushuaikobe
liushuaikobe / Java-Singleton.java
Last active December 22, 2015 10:38
简单单例模式的实现,用JVM保证线程安全
import java.net.UnknownHostException;
import com.mongodb.DB;
import com.mongodb.MongoClient;
import com.qingcong.mobile.constant.AppConfig;
public class MongoHelper {
private MongoClient mongoClient;
private DB db;
@liushuaikobe
liushuaikobe / BM-algorithm.py
Last active December 18, 2015 11:09
Boyer-Moore algorithm Implementation via Python.
'''
Created on 2013-6-13
@author: liushuai
'''
import time
badCharShift = {}
goodSuffixShift = {}