Skip to content

Instantly share code, notes, and snippets.

View reorx's full-sized avatar
YOLO

Xiao Meng reorx

YOLO
View GitHub Profile
@reorx
reorx / pysimulation_3.py
Created October 28, 2011 04:17
os_storage
#!/usr/bin/python
#coding=utf8
import sys
from utils import col_decorate, BaseError
class InputError(BaseError):
pass
@reorx
reorx / gitconfig
Created October 28, 2011 11:32
gitconfig sample
[alias]
ci = commit
cim = commit -m
st = status
aa = add -A
lg = log --graph --pretty=oneline --abbrev-commit --decorate
last3 = log -3
[core]
editor = vim
@reorx
reorx / my.cnf
Created October 28, 2011 12:10
update mysql to support zh_CN
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
init_connect='SET NAMES utf8'
[mysql]
default-character-set=utf8
@reorx
reorx / dns-server
Created November 2, 2011 04:30 — forked from ri0day/dns-server
dns-socket
#!/usr/bin/python
import socket,select
# -*- coding: utf-8 -*-
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the _run() method
#!/usr/bin/python
#coding=utf8
def directSelectSort(seq, mode='b-s'):
"""
:b-s :: big -> small
:s-b :: small -> big
"""
size = len(seq)
for i in range(0, size - 1):
@reorx
reorx / tornado-nginx-example.conf
Created November 26, 2011 22:29 — forked from didip/tornado-nginx-example.conf
Nginx config example for Tornado
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
@reorx
reorx / gist:1758983
Created February 7, 2012 10:22 — forked from hongqn/gist:1758954
A benchmark tool in eventlet
#!/usr/bin/env python
# encoding: UTF-8
"""DoubanServiceBench"""
__author__ = "Qiangning Hong <[email protected]>"
__version__ = "$Revision: 51434 $"
__date__ = "$Date: 2010-11-17 17:44:38 +0800 (Wed, 17 Nov 2010) $"
import sys
@reorx
reorx / gist:2033857
Created March 14, 2012 03:40 — forked from jkeyes/gist:1242040
Compile LESS files when a save is detected
#!/bin/bash
watchmedo shell-command --patterns="*.less" --command=\
'LESS=`echo "${watch_src_path}" | sed s/.less/.css/`; \
echo compile: "${watch_src_path}";\
lessc "${watch_src_path}" "${LESS}"; \
if [ "$?" -eq "0" ]; then echo wrote: "${LESS}"; fi' $*
@reorx
reorx / sublime-settings.js
Created March 22, 2012 03:26 — forked from rochacbruno/sublime-settings.js
Sublime text pyflakes ignore for web2py identifiers
/*
SublimeLinter default settings
*/
{
/*
Sets the mode in which SublimeLinter runs:
true - Linting occurs in the background as you type (the default).
false - Linting only occurs when you initiate it.
"load-save" - Linting occurs only when a file is loaded and saved.
@reorx
reorx / encoding_converter.py
Created April 4, 2012 05:21
char detect & convert
#!/usr/bin/python
# -*- coding: utf-8 -*-
import chardet
BROTHER_ENCODINGS = [
('GB2312', 'GBK', 'GB18030'),
]