Skip to content

Instantly share code, notes, and snippets.

View xmzhao's full-sized avatar

Xuemin Zhao xmzhao

  • Tencent
  • Chengdu, China
View GitHub Profile
@xmzhao
xmzhao / build_gcc4.7.1.sh
Created November 15, 2012 06:36 — forked from Mistobaan/build_gcc4.7.1.sh
Build GCC 4.7.1 on Mac OS X Lion with Go support
#!/bin/sh
# GCC
## Prerequisites for GCC
## http://gcc.gnu.org/install/prerequisites.html
## Installing GCC: Configuration
## http://gcc.gnu.org/install/configure.html
GCC_VER=4.7.1
WORK_DIR=$HOME/Builds/GCC
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state
@xmzhao
xmzhao / connection_pool
Created December 2, 2016 07:16 — forked from opensourcegeek/connection_pool
A quick and easy way to reconnect to mysql when connection is lost, it uses gevent queues but still the idea should work whichever way the connections are pooled.
from gevent import monkey
monkey.patch_socket()
import logging
import gevent
from gevent.queue import Queue
import pymysql as db
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger("connection_pool")
@xmzhao
xmzhao / merge_git_repo_as_subdir
Last active September 16, 2019 08:14 — forked from smdabdoub/merge_git_repo_as_subdir
Merge one git repository into another repository as a sub-directory
# based on the following:
# http://saintgimp.org/2013/01/22/merging-two-git-repositories-into-one-repository-without-losing-file-history/
# http://blog.caplin.com/2013/09/18/merging-two-git-repositories/
git clone Task (保证在master)
git clone DopNluServer (保证在master)
cd Task
git remote add DopNluServer ../DopNluServer
git fetch DopNluServer