This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 改为你自己的密码 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 2; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
use epoll; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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> | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" }}}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 |
OlderNewer