Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
apigen \
--source ./vendor/laravel \
--source ./vendor/symfony \
--source ./vendor/monolog \
--exclude "*/tests/*" \
--exclude "*/Tests/*" \
--destination ./ldocs/ --title "Laravel Framework 4.1"
from threading import _Timer
class Timer(_Timer):
def __init__(self, interval, handler, repeats=0, args=[], kwargs={}):
_Timer.__init__(self, interval, self.__invoke, args, kwargs)
self.handler = handler
self.repeats = repeats
#! /bin/sh
### BEGIN INIT INFO
# Provides: FastCGI servers for Django
# Required-Start: networking
# Required-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Start FastCGI servers with Django.
# Description: Django, in order to operate with FastCGI, must be started
# in a very specific way with manage.py. This must be done
@harryxu
harryxu / quicksort.py
Created July 26, 2010 13:39
quicksort (Python)
#!/usr/bin/env python
def quicksort1(q):
"""
The basic version.
http://zh.wikipedia.org/wiki/%E5%BF%AB%E9%80%9F%E6%8E%92%E5%BA%8F#.E6.BC.94.E7.AE.97.E6.B3.95
"""
less = []
pivotList = []
greater = []
@harryxu
harryxu / vcsup
Created August 13, 2010 06:17
vcsup. Update all vcs dirs in a specific path.
#!/usr/bin/env bash
# Update all vcs dirs in a specific path.
# Support git, hg and svn.
basePath=`pwd`
function vcsup()
{
echo "checing $1"
@harryxu
harryxu / views.py
Created December 13, 2010 02:34
gitweb in django
import os, sys, subprocess, httplib
from cStringIO import StringIO
from django.http import HttpResponse
def gitweb(request):
cigenv = {
'REQUEST_METHOD': request.method,
'QUERY_STRING': request.META['QUERY_STRING'],
}
os.environ.update(cigenv)
@harryxu
harryxu / .vromerc
Created January 8, 2012 07:22
Vromerc
unmap <M-d>
unmap <C-f>
set disablesites=mail.google.com, reader.google.com, localhost, 127.0.0.1
" vim: set ft=vim:
@harryxu
harryxu / cnv.sh
Created September 19, 2012 11:13
#!/usr/bin/env bash
CURRENT_PATH=`pwd`
outdir="$CURRENT_PATH/out"
if [[ ! -d $outdir ]]; then
mkdir $outdir
fi
cd "$CURRENT_PATH/origin"
VIDEOS=`find . -name "*"`
@harryxu
harryxu / change_prefix.sql
Created December 9, 2011 04:50
批量修改MySQL表前缀
-- http://blog.itmem.com/?p=1062
-- @author xueyu
-- @desc modify the prefix of table name in db
-- @example
--
-- use DBNAME;
-- show tables;
-- source ~/change_prefix.sql;
--
-- call change_prefix('old_', 'new_', 'DBNAME');
@harryxu
harryxu / fontconfig.properties
Created March 23, 2013 06:51
Java字体配置文件,优化了等宽字体与中文。
# @(#)fontconfig.properties 1.5 04/01/28
#
# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
#
# Version
version=1
# Component Font Mappings