Skip to content

Instantly share code, notes, and snippets.

View fanzeyi's full-sized avatar

Zeyi (Rice) Fan fanzeyi

View GitHub Profile
@fanzeyi
fanzeyi / fetch.py
Created April 5, 2012 18:10
备份饭否消息。 非API
# -*- coding: utf-8 -*-
# AUTHOR: Zeray Rice <fanzeyi1994@gmail.com>
# FILE: main.py
# CREATED: 01:15:37 06/04/2012
# MODIFIED: 01:57:15 06/04/2012
import requests
import datetime
from jinja2 import Environment, FileSystemLoader
from BeautifulSoup import BeautifulSoup
@fanzeyi
fanzeyi / gist:2397262
Created April 16, 2012 09:31
ibus-pinyin 修改简体中文状态下方括号
--- a/src/PYFallbackEditor.cc
+++ b/src/PYFallbackEditor.cc
@@ -53,9 +53,9 @@ FallbackEditor::processPunctForSimplifiedChinese (guint keyval, guint keycode, g
// case '=':
// case '+':
case '[':
- commit ("【"); return TRUE;
+ commit ("「"); return TRUE;
case ']':
- commit ("】"); return TRUE;
var count;
var fetching = false;
chrome.browserAction.onClicked.addListener(function(a) {
chrome.tabs.create({'url' : 'http://www.v2ex.com/notifications'});
});
function fetchNotify() {
if(!fetching) {
fetching = true;
$.get("http://www.v2ex.com/faq", function(r) {
count = r.match(/<title>V2EX \((.*)\)<\/title>/);
class PageHandler(tornado.web.RequestHandler):
def get(self):
# for method GET
pass
def post(self):
# for method POST
pass
@fanzeyi
fanzeyi / xiami_decode.js
Created April 29, 2012 15:24 — forked from dndx/xiami_decode.py
Xiami URL Decoder
function decode(loca) {
var result = [], url = "";
var line, rows, extra;
loca = loca.trim();
if(loca === "") {
return "";
}
line = Number(loca[0]);
rows = Math.floor((loca.length - 1) / line);
extra = (loca.length - 1) % line;
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/tornado/web.py", line 988, in _execute
getattr(self, self.request.method.lower())(*args, **kwargs)
File "/www/v2ex/galaxy/handlers/web/notifications.py", line 49, in get
one = self.store.find(Member, Member.notification_token == token).one()
File "/usr/lib/python2.6/site-packages/storm-0.19-py2.6-linux-x86_64.egg/storm/store.py", line 1145, in one
raise NotOneError("one() used with more than one result available")
NotOneError: one() used with more than one result available
local SaySapped = CreateFrame("Frame")
SaySapped:SetScript("OnEvent",function(_, _, _, eventType, _, _, _, _, _, _, destName, _, _, spellID)
if ((eventType == "SPELL_AURA_APPLIED" or eventType == "SPELL_AURA_REFRESH") and (destName == UnitName("player"))) then
if (spellID == 6770) then
SendChatMessage("<<有贼>>", "SAY")
elseif (spellID == 6771) then
SendChatMessage("<<有贼2>>", "SAY")
end
end
end)
import grequests
BASE_PATH = 'http://xxxxx.com/web/_photo/pic/'
urls = ["%d0000%s%d" % (year, '0'*(4-len(str(no))), no) for year in range(2005, 2012) for no in range(2001)]
rs = (grequests.get(BASE_PATH + u + '.JPG') for u in urls)
result = grequests.map(rs)
@fanzeyi
fanzeyi / rc,lua
Created July 16, 2012 10:04
awesome.config
-- Standard awesome library
require("awful")
require("awful.autofocus")
require("awful.rules")
-- Theme handling library
require("beautiful")
-- Notification library
require("naughty")
naughty.config.default_preset.width = 400
import calendar
START_YEAR = 2012
END_YEAR = 2012
START_MONTH = 7
END_MONTH = 7
cal = calendar.Calendar()
result = ["&year=%d&month=%d&day=%d" % (year, month, day) \
for year in range(START_YEAR, END_YEAR + 1) \