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
--- getCover.py 2010-01-25 21:44:58.000000000 +0800 | |
+++ getCover/getCover.py 2010-01-25 15:30:40.000000000 +0800 | |
@@ -3,10 +3,14 @@ | |
# @author mingcheng<i.feelinglucky@gmail.com> | |
# @site http://www.gracecode.com/ | |
# @date 2010-01-22 | |
import eyeD3, re, os, sys, time, urllib | |
urlread = lambda url: urllib.urlopen(url).read() |
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
; Right click the link, then surf the https page instead of the http one. | |
; menu.ini of Opera | |
; [Link Popup Menu] | |
Item, https=New page & Go to page, "javascript:location.href='%l'.replace(/^http/, 'https');" |
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
; 我不要全局代理,只需要通过PAC。开启某个代理软件后能在Opera里方便的切换对应的pac文件 | |
; pac文件没法判断当前使用的是那个代理软件,所以只能根据不同的代理软件写多个pac文件 | |
; vvoodysToolbar.ini | |
Button0, "PAC"="Enable proxy servers, , , "PAC", "New folder" | Disable proxy servers + Show popup menu, "PAC menu"" | |
; vvoodysMenu.ini | |
[PAC Menu] | |
Item, 使用GAP=show preferences & show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert, "file:///C:/Users/vvoody/AppData/Roaming/Opera/Opera/proxy-gap.pac" & OK & Delay, 10 & Cancel | |
Item, 使用IndiaWebProxy=show preferences & show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Check item & Focus next widget & Insert, "file:///C:/Users/vvoody/AppData/Roaming/Opera/Opera/proxy-indiawebproxy.pac" & OK & Delay, 10 & Cancel | |
Item, 关闭PAC=show preferences & show proxy servers & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Focus previous widget & Unc |
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 | |
# TEST | |
# sh find_substring_position.sh "find substring position" "g p" => 13 | |
# sh find_substring_position.sh foodforthought.jpg fo => 0 | |
function find_substring_position() | |
{ | |
longstr=$1 | |
substr=$2 |
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 random | |
a = [] | |
def bingo(n): | |
b = [] | |
while len(b) < n: | |
s = random.randint(0,120) | |
if s in a: | |
continue | |
b.append(s) |
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
# 返回中通速递订单的跟踪记录 | |
# Return trace records of order of ZTO Express. | |
curl -d "ID=1234567890" http://zto.cn/bill.aspx | grep '<td width="82">' | iconv -f GB2312 -t UTF-8 | sed 's/^[\t ]*//' | sed 's/<[^>]*>/|/g' |
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 datetime | |
# I wanna create some thing in advance monthly, so I need to know the next month(and next year as well). | |
# Calculating previos month is pretty simple, send 'days=-1' to timedelta. | |
def nextmo(d, days=31): | |
"""Return today's next month. If want previous month, set 'days' to '-1'.""" | |
mo = d.month | |
yr = d.year | |
nm = datetime.date(yr,mo,1)+datetime.timedelta(days=days) |
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 | |
# -*- coding: utf-8 -*- | |
from BaseHTTPServer import HTTPServer,BaseHTTPRequestHandler | |
class MyHttpHandler(BaseHTTPRequestHandler): | |
def do_GET(self): | |
print self.headers | |
print self.path | |
self.send_response(200) |
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 | |
# use PostgreSQL for example | |
import pgdb | |
def get_namespace_oid(db, name): | |
cx = db.cursor() | |
cx.execute('SELECT oid FROM pg_namespace WHERE nspname=%s', (name,)) | |
row = cx.fetchone() | |
cx.close() |
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
# part of /etc/nginx/nginx.conf | |
server { | |
listen 80; | |
server_name vvoody.org; | |
location ~ /blog[/]?$ { | |
if ($query_string ~ p=([0-9]+)) { | |
rewrite ^(.*) http://blog.vvoody.org/article/$arg_p? permanent; | |
#set $article_id $1; |
OlderNewer