Skip to content

Instantly share code, notes, and snippets.

@cute
cute / weibo.js
Created March 30, 2012 03:04
Fix Weibo Comment Click Bug in Opera 11.62
// ==UserScript==
// @name Fix KeyboardEvent
// @namespace weibo
// @include http://weibo.com/*
// @include http://www.weibo.com/*
// ==/UserScript==
(function (){
window.KeyboardEvent=window['KeyboardEvent']||null;
})();
@cute
cute / GetDocinfo-2.0.4.patch
Created March 30, 2012 08:29
Sphinx 2.0.4 GetDocinfo Patch
diff -rup sphinx-2.0.4-release/api/sphinxapi.php 2.0.4/api/sphinxapi.php
--- sphinx-2.0.4-release/api/sphinxapi.php 2012-01-31 07:07:35.000000000 +0800
+++ 2.0.4/api/sphinxapi.php 2012-03-30 16:39:25.000000000 +0800
@@ -27,6 +27,7 @@ define ( "SEARCHD_COMMAND_KEYWORDS", 3 )
define ( "SEARCHD_COMMAND_PERSIST", 4 );
define ( "SEARCHD_COMMAND_STATUS", 5 );
define ( "SEARCHD_COMMAND_FLUSHATTRS", 7 );
+define ( "SEARCHD_COMMAND_DOCINFO", 9 );
/// current client-side command implementation versions
@cute
cute / GetDocinfo-2.0.4.patch
Created March 30, 2012 13:09 — forked from cute/GetDocinfo-2.0.4.patch
Sphinx 2.0.4 GetDocinfo Patch
diff -rup sphinx-2.0.4-release/api/sphinxapi.php 2.0.4/api/sphinxapi.php
--- sphinx-2.0.4-release/api/sphinxapi.php 2012-01-31 07:07:35.000000000 +0800
+++ 2.0.4/api/sphinxapi.php 2012-03-30 16:39:25.000000000 +0800
@@ -27,6 +27,7 @@ define ( "SEARCHD_COMMAND_KEYWORDS", 3 )
define ( "SEARCHD_COMMAND_PERSIST", 4 );
define ( "SEARCHD_COMMAND_STATUS", 5 );
define ( "SEARCHD_COMMAND_FLUSHATTRS", 7 );
+define ( "SEARCHD_COMMAND_DOCINFO", 9 );
/// current client-side command implementation versions
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
'''
redis_search.py
Written by Josiah Carlson July 3, 2010
Released into the public domain.
This module implements a simple TF/IDF indexing and search algorithm using
Redis as a datastore server. The particular algorithm implemented uses the
@cute
cute / GetDocinfo-2.0.1.patch
Created April 1, 2012 06:27
Sphinx 2.0.1 GetDocinfo Patch
diff -rup sphinx-2.0.1-beta/src/searchd.cpp 2.0.1/src/searchd.cpp
--- sphinx-2.0.1-beta/src/searchd.cpp 2011-04-22 02:16:02.000000000 +0800
+++ 2.0.1/src/searchd.cpp 2011-09-01 12:30:02.000000000 +0800
@@ -439,7 +439,8 @@ enum SearchdCommand_e
SEARCHD_COMMAND_PERSIST = 4,
SEARCHD_COMMAND_STATUS = 5,
SEARCHD_COMMAND_FLUSHATTRS = 7,
-
+ SEARCHD_COMMAND_SEGMENT = 8,
+ SEARCHD_COMMAND_DOCINFO = 9,
@cute
cute / GetDocinfo-1.10.patch
Created April 1, 2012 06:28
Sphinx 1.10 GetDocinfo Patch
diff -rup sphinx-1.10-beta/src/searchd.cpp 1.10/src/searchd.cpp
--- sphinx-1.10-beta/src/searchd.cpp 2010-07-19 23:56:34.000000000 +0800
+++ 1.10/src/searchd.cpp 2011-09-01 11:39:24.000000000 +0800
@@ -353,6 +353,8 @@ enum SearchdCommand_e
SEARCHD_COMMAND_STATUS = 5,
SEARCHD_COMMAND_QUERY = 6,
SEARCHD_COMMAND_FLUSHATTRS = 7,
+ SEARCHD_COMMAND_SEGMENT = 8,
+ SEARCHD_COMMAND_DOCINFO = 9,
@cute
cute / __init__.py
Created August 23, 2012 15:05 — forked from ipconfiger/__init__.py
OAuth包,实现了sina,QQ,网易,搜狐的OAuth认证
# -*- Encoding: utf-8 -*-
import base64
import binascii
import cgi
import hashlib
import hmac
import logging
import time
import urllib
import urlparse
@cute
cute / python_infrastructure.md
Created October 12, 2012 09:45 — forked from onlytiancai/python_infrastructure.md
python 基础设施讨论贴

python项目通用组件和基础服务

很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。

每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。

原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。

另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。

@cute
cute / preview.html
Created November 3, 2012 06:45 — forked from airyland/preview.html
preview image before upload
<!DOCTYPE html>
<html>
<head>
<meta chraset="utf-8" />
<style type="text/css">
#kk{
width:400px; height:400px; overflow: hidden;
}
#preview_wrapper{
width:300px; height:300px; background-color:#CCC; overflow: hidden;