Felix Yan | 2011-01-25 | 1,259 views
首先赞PT大牛帮了很多忙, 本文大部分原型来源于 http://apt-blog.net/moinmoin-on-nginx-via-fastcgi-and-uwgi
UPDATE: 更新到 nginx 1.0 / uwsgi 0.9.6.8 的配置 – 2011/4/15
然而由于现在那几个玩意版本更新挺厉害, 有许多配置都不一样了, 再加上本猫是要让它运行bottle, 所以决定重新整理一下:)
下面这段关于 uwsgi 的介绍 来自PT牛的那篇文章:
uwsgi充当了python解析器的角色,使用wsgi的接口和Python程序交互,这个过程中做了优化,和上层nginx之间则设计了更加轻量的协议。nginx0.8.40以后官方默认带了uwsgi的协议模块,所以使用很方便。
恩, 由上面这段话 我们可以淡定的看出, 官方源里那个残念的0.7.x的nginx肯定是满足不了要求的啦!
Read the rest of this entry »
Felix Yan | 2011-01-23 | 254 views
效果图: 
原插件来自 http://www.discuz.net/thread-1624289-1-1.html
原插件是 For Discuz 7.2 的, 我进行了一些修改使得它在 Discuz X1.5 下正常工作.
注: 本插件用到的 js/图片 资源请到上面的地址下载.
下面就是安装步骤了 很抱歉这个插件仍然一点都不GREEN
1, 编辑 source/function/function_discuzcode.php 找到这几行:
if($allowbbcode) {
if(strpos($msglower, 'ed2k://') !== FALSE) {
$message = preg_replace("/ed2k:\/\/(.+?)\//e", "parseed2k('\\1')", $message);
}
}
修改为:
if($allowbbcode) {
if(strpos($msglower, 'ed2k://') !== FALSE) {
$message = preg_replace("/\s*\[emule\](.+?)\[\/emule\]\s*/ies", "emu('\\1')", $message);
}
}
Read the rest of this entry »
Felix Yan | 2011-01-20 | 1,582 views
刷上 Froyo 的盆友们在安装 OpenVPN 的时候会怨念的发现, “明明在 OpenVPN Settings 里显示已连接, 却连一点连接上了的感觉都没有呢?”
如果在终端里手动键入 openvpn 的命令来获得反馈的 log, 会得到下面这样让你感到十分 confused 的结果:
Sat Jul 3 13:30:58 2010 Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:4: route (2.1.1)
Sat Jul 3 13:30:58 2010 Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:7: ifconfig (2.1.1)
神马? 找不到哥的 route 和 ifconfig 命令? 他们都很乖的呆在 /system/xbin 里呢…
恩, 这貌似是一个已知的 bug ,暂时可以用下面的猥琐方法给 workaround 掉:
首先, 你要保证你的内核有 tun 设备. 如果没有, 则需要到网上找到对应你内核版本的 tun.ko 文件手动刷进去:) (这些内容就不再赘述)
然后, 进入你的 root 终端, 输入下面的命令:
mkdir /system/xbin/bb
ln -s /system/xbin/ifconfig /system/xbin/bb/
ln -s /system/xbin/route /system/xbin/bb/
然后, 像你以前做的一样, 进 Market 装上 OpenVPN Installer.
注意: 安装Binary的时候选择route等命令的路径到 /system/xbin/bb
然后…恭喜你, 就这么简单:)
参考资料: http://code.google.com/p/android-openvpn-installer/issues/detail?id=2
Felix Yan | 2011-01-17 | 232 views
恩, 很久没发python小工具了, 现在来发点=.=
串群检查 – 检查两个或多个QQ群里相同的QQ号, 输出每个QQ号在哪些群及在各群的马甲.
输入格式:
1群: 1.txt
2群: 2.txt
…
把1.txt, 2.txt, 3.txt等文件和下面的py脚本放一个目录里, 然后运行py脚本即可~
下面就是代码啦~
v0.2 – 2011/01/18
重写了算法, 速度更快
增加了全部群友信息输出, 方便管理员查找
感谢牛B轰轰的吉米大大贡献代码!
#coding:utf-8
#!/usr/bin/env python
# QQ 串群检查 - By Felix Yan GPL v3
# felixonmars@gmail.com
# http://blog.felixc.at
import sys
chuanqun = []
ren = []
for i in range(1,100):
try:
f = open("%d.txt" % (i), "r")
for line in f:
try:
tmp = line.decode(sys.getfilesystemencoding()).strip().split()
qq = tmp[-1]
nick = tmp[0]
ren.append([qq, [str(i), nick]])
except:
pass
except IOError:
pass
#下面这段精妙的代码是吉米大大的!!!!!!!!!
d = {}
l = []
for i, j in ren:
try:
d[i] += [j]
except KeyError:
d[i] = [j]
for i in d.keys():
l += [[i] + d[i]]
l.sort(key=lambda x:int(x[0]))
ren = l
for i in ren:
if len(i[1:]) > 1:
chuanqun.append(i)
chuanqun.sort(key=lambda x:len(x[1:]), reverse=True)
resultchuan = []
for i in chuanqun:
resultchuan.append(u"%s 串群 %s" % (i[0], ", ".join([u"%s群(%s)" % (x[0], x[1]) for x in i[1:]])))
f = open(u"串群检查结果.txt".encode(sys.getfilesystemencoding()), "w")
f.write("\n".join(resultchuan).encode(sys.getfilesystemencoding()))
f.close()
resultall = []
for i in ren:
resultall.append(u"%s 在 %s" % (i[0], ", ".join([u"%s群(%s)" % (x[0], x[1]) for x in i[1:]])))
f = open(u"全部群员信息.txt".encode(sys.getfilesystemencoding()), "w")
f.write("\n".join(resultall).encode(sys.getfilesystemencoding()))
f.close()
Read the rest of this entry »
Felix Yan | 2011-01-17 | 1,765 views
本猫入爪机(T-Mobile G2)半月, 折腾ROM/Kernel/App无数=.=
现在我安装了下面这些常用到的App(Google自带的就不提啦), 供分享, 供参考.
1, 3G Watchdog Pro
流量监控 最靠谱的一个… 有时候比ISP统计的还多一点点, 总之不会少
有按月/周/天的统计报表, 有一个还不错的Widget, 而且, 能显示每个App使用了多少流量
2, Adfree
恩, 各种去广告, 很多时候还是不错的 XD
3, Adobe Flash Player
为了优酷/土豆, 不得不弄一个=.=
4, Advanced Task Killer Free
杀进程用的Tool, 目前觉得它最正常=.=
5, Angry Birds
额, 这个..你懂的…(还有Seasons版)
Read the rest of this entry »
Felix Yan | 2011-01-15 | 167 views
写在前面: 本文希望通过一个具体的修改编译安装Ubuntu系统软件包的过程 帮助在编译安装时遇到类似问题的盆友解决问题.
恩, 首先呢, 这个问题仅仅针对启用了 ppa:xorg-edgers/ppa 的 alpha tester 盆友…
这个悲剧已经有两个多月(以上)的历史拉(因为两个多月前Felix才忍不住去report了), 我report的错误参见: https://bugs.launchpad.net/ubuntu/+source/pixman/+bug/623272
不过某位大大(Peter Clifton)给出了解决方案, 这里简单解释一下…
首先获得当前版本的notify-osd的源代码:
sudo apt-get source notify-osd
完成后进入目录, 把下面的patch存成文件 然后用patch命令应用上去:
=== modified file 'src/tile.c'
--- src/tile.c 2009-07-31 11:07:29 +0000
+++ src/tile.c 2010-12-06 00:24:55 +0000
@@ -180,7 +180,7 @@
// top right
cairo_matrix_init_scale (&matrix, -1.0f, 1.0f);
- cairo_matrix_translate (&matrix, -width, 0.0f);
+ cairo_matrix_translate (&matrix, -1.0f * width, 0.0f);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_rectangle (cr,
width - pad_width,
@@ -193,7 +193,7 @@
// bottom right
cairo_matrix_init_scale (&matrix, -1.0f, -1.0f);
- cairo_matrix_translate (&matrix, -width, -height);
+ cairo_matrix_translate (&matrix, -1.0f * width, -1.0f * height);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_rectangle (cr,
pad_width,
@@ -206,7 +206,7 @@
// bottom left
cairo_matrix_init_scale (&matrix, 1.0f, -1.0f);
- cairo_matrix_translate (&matrix, 0.0f, -height);
+ cairo_matrix_translate (&matrix, 0.0f, -1.0f * height);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_rectangle (cr,
x,
然后
Read the rest of this entry »