Skip to content

Instantly share code, notes, and snippets.

View binux's full-sized avatar

Roy Binux binux

View GitHub Profile
@binux
binux / gist:1384677
Created November 22, 2011 02:10
a diff function base on Advanced Dynamic Programming
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Created on 2011-6-7
Modified on 2011-11-22
a diff function base on Advanced Dynamic Programming
http://www.avatar.se/molbioinfo2001/dynprog/adv_dynamic.html
@author: binux
@binux
binux / jsfunctionParser.py
Created December 14, 2011 13:12
xunlei lixian plugin for flexget
# jsonParser.py
#
# Implementation of a simple JSON parser, returning a hierarchical
# ParseResults object support both list- and dict-style data access.
#
# Copyright 2006, by Paul McGuire
#
# Updated 8 Jan 2007 - fixed dict grouping bug, and made elements and
# members optional in array and object collections
#
@binux
binux / mem_cache.py
Created January 6, 2012 11:39
一个通用的python function cache
# -*- coding: utf-8 -*-
#
# Copyright(c) 2010 poweredsites.org
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@binux
binux / proxyheader.php
Created January 6, 2012 15:49
请求信息输出
<html>
<head>
<title>CS_ProxyJudge ver 1.0</title>
</head>
<body bgcolor="#808080">
<font color="#FFFFFF"><B>
<PRE>
<?
//=======================================================================
// 修改记录:
@binux
binux / daemon.sh
Created January 10, 2012 07:38
防止多重启动的守护进程
#!/usr/bin/env bash
if [ ! $STY ]; then
screen -S $(basename $0 .sh) -U -d -m $0 $*
exit 0
fi
if [ ! $LOCK ]; then
LOCK=$(echo $0 $* | md5sum | cut -f 1 -d " ").lock
fi
#!/usr/bin/env bash
set -x
sleep 10 &
PID=$!
while kill -0 $PID
do
ps h -o pcpu,pmem -p $PID
@binux
binux / encode_fix.py
Created April 24, 2012 11:20
fix encoding for unicode in term.
import sys
import codecs
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
@binux
binux / TLE.user.js
Created July 19, 2012 07:42
export thunder lixian url to aria2/wget
// ==UserScript==
// @name ThunderLixianExporter
// @namespace http://binux.me/
// @version 0.1
// @description export thunder lixian url to aria2/wget
// @match http://dynamic.cloud.vip.xunlei.com/user_task?*
// @run-at document-end
// @copyright 2012+, You
// ==/UserScript==
@binux
binux / google_image_search.py
Created August 13, 2012 07:46
search for a larger size of image
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<17175297.hk@gmail.com>
# http://binux.me
# Created on <T_CREATE_DATE>
import sys
import re
import requests
@binux
binux / basedb.py
Created August 30, 2012 12:28
basedb for sqlite
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<17175297.hk@gmail.com>
# http://binux.me
# Created on 2012-08-30 17:43:49
import logging
logger = logging.getLogger()