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 / sshgfw
Created October 25, 2010 12:42 — forked from fuckgfw/sshgfw
#!/usr/bin/expect
set timeout 60
spawn /usr/bin/ssh -D 7070 -g username@yourserver.com
#这里的 username 为你自己的用户名,yourserver.com 为你自己的服务器域名或ip
expect {
"password:" {
send "password\r"
#将第二个 password 改为你自己的密码
}
@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
@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 <hongqn@gmail.com>"
__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 / gist:2600380
Created May 5, 2012 06:38 — forked from agriffis/gist:2481292
.bashrc.virtualenvwrapper
# Dynamically load virtualenvwrapper functions to reduce shell startup
# time.
#
# Copyright 2012 Aron Griffis <aron@arongriffis.com>
# Released under the GNU GPL v3
#######################################################################
# Python virtualenvwrapper loads really slowly, so load it on demand.
if [[ $(type -t workon) != function ]]; then
virtualenv_funcs=( workon deactivate mkvirtualenv )
@reorx
reorx / zipdb.py
Created June 18, 2012 07:10 — forked from mayli/zipdb.py
Use a zipfile store a dict like k-v database
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# zipdb.py
# Use a zipfile store a dict like k-v database.
# Known bug: duplicate key(filenames) allowed
#
# Copyright 2012 mayli <mayli.he@gmail.com>
#
@reorx
reorx / xiami_decode.py
Created November 17, 2012 19:17 — forked from dndx/xiami_decode.py
Xiami URL Decoder
import urllib2
def xiami_decode(s):
s = s.strip()
if not s:
return False
result = []
line = int(s[0])
rows = len(s[1:]) / line
extra = len(s[1:]) % line
" }}}2 字串長度(column 數) {{{2
function StrWidth(str)
if exists('*strwidth')
return strwidth(a:str)
else
let strlen = strlen(a:str)
let mstrlen = strlen(substitute(a:str, ".", "x", "g"))
if strlen == mstrlen
return strlen