Skip to content

Instantly share code, notes, and snippets.

@shellexy
shellexy / chromium.sh
Created November 26, 2011 11:17
苏酱要的 chromium.sh
#!/bin/bash
# ~/bin/chromium.sh
# 使用内存文件系统加速 chromium 运行
# 启动前和关闭后同步文件
CMD="chromium"
RAM_CACHE_DIR="/dev/shm/$USER-chrome-cache/"
DISK_CACHE_DIR="$HOME/.cache/chromium/"
@shellexy
shellexy / webstore 图片要求
Created December 6, 2011 07:30
This small tile image has been rejected due to the following reason: Too much whitespace Please review the guidelines, upload a new image and republish.
The Chrome Web Store is getting a new look! In the coming weeks, we’ll roll out a new version of the store that requires new images. If you want to provide images in the old sizes, as well, you can do so using the “current store look” tab.
Provide images that the store can use to promote your item. Although only the small box image is required, your item might be featured more prominently if you also provide a large box image, a marquee image, or both.
Fill the entire region, using square corners and no padding (full bleed).
Use a medium or dark background.
Avoid text in the image as much as possible.
Don’t put white elements along the edges of the image; the edges should be well defined.
Don't use a screenshot.
Your image should display well when reduced to half size.
Note: The size of promotional images in the current Chrome Web Store is different from the size in the new-look store.
@shellexy
shellexy / networkid.html.txt
Created December 17, 2011 03:53
RT @cxiaoji 蛋疼前40小时共采样224441条简体中文推,约为繁体两倍,以简体中文为主力语言的独立id 31107个。刷屏排行见此: http://xiaoji-chen.com/network/id.html
2011-12-15 2AM - 2011-12-16 6PM 不定期更新中
1 zgmlhx
2 gengdie
3 caoliu520
4 taidaonet
5 dengbot
6 banyilin
7 pinggaozhi
8 jackbilldarren
9 mlhshhs
@shellexy
shellexy / twip4-x-phx.diff
Created February 18, 2012 00:44
让 twip4 api 限额提高到 1000
--- twip/include/twitteroauth.php 2012-02-18 08:13:25.000000000 +0000
+++ twip/include/twitteroauth.php 2012-02-18 08:14:27.000000000 +0000
@@ -219,6 +219,8 @@
if (!empty($postfields)) {
$url = "{$url}?{$postfields}";
}
+ case 'GET':
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-PHX: true'));
}
@shellexy
shellexy / newx.sh
Created March 22, 2012 06:10
启动 Xephyr 来测试(可能挂掉 X 的)程序
#!/bin/sh -x
SIZE=1270x710
unset SESSION_MANAGER XDG_SESSION_COOKIE DBUS_SESSION_BUS_ADDRESS DESKTOP_SESSION
#Xephyr -screen 1270x715 -ac +bs +xinerama -fakexa -dpi 110 :3 &
Xephyr -zaphod -screen $SIZE -ac +bs +xinerama -dpi 110 :3 &
sleep 1s
export DISPLAY=:3
xrdb < ~/.Xresources
eval `dbus-launch --sh-syntax`
export XMODIFIERS=@im=fcitx QT_IM_MODULE=xim GTK_IM_MODULE=xim ; fcitx & sleep 1
@shellexy
shellexy / format_html.py
Created March 26, 2012 06:39
py 给 html 添加适当换行,以便版本管理
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
import re
def format_html(html):
'''给 html 添加适当换行,以便版本管理
'''
html = re.sub('\n?\ ?<(address|blockquote|center|dir|div|dl|fieldset|form|h1|h2|h3|h4|h5|h6|hr|isindex|menu|noframes|noscript|ol|p|pre|table|ul|dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr)([^>]*?)>', '\n<\\1\\2>', html)
html = re.sub('</(address|blockquote|center|dir|div|dl|fieldset|form|h1|h2|h3|h4|h5|h6|hr|isindex|menu|noframes|noscript|ol|p|pre|table|ul|dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr)([^>]*?)>\ ?\n?', '</\\1\\2>\n', html)
@shellexy
shellexy / htmldiff.py
Created March 26, 2012 06:43
html 易读格式显示 html 版本间差异
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
from difflib import SequenceMatcher
import re
from StringIO import StringIO
import cgi
import base64
@shellexy
shellexy / CGIHTTPServer.py
Created March 28, 2012 08:38
只是测试 cgi 页面的话,不妨用自带的服务器 python -m CGIHTTPServer。这个则是多线程的修改版本
"""CGI-savvy HTTP Server.
This module builds on SimpleHTTPServer by implementing GET and POST
requests to cgi-bin scripts.
If the os.fork() function is not present (e.g. on Windows),
os.popen2() is used as a fallback, with slightly altered semantics; if
that function is not present either (e.g. on Macintosh), only Python
scripts are supported, and they are executed by the current process.
@shellexy
shellexy / dabr_X-PHX.diff
Created April 15, 2012 08:14
让 dabr api 限额提高到 1000
diff --git a/dabr/common/twitter.php b/dabr/common/twitter.php
--- a/dabr/common/twitter.php
+++ b/dabr/common/twitter.php
@@ -376,6 +376,10 @@ function twitter_process($url, $post_dat
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post_data);
}
+ if($post_data == false)
+ {
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-PHX: true'));
@shellexy
shellexy / dabr_expanded_t.co.diff
Created April 15, 2012 08:14
让 dabr 展开 t.co 短链
diff --git a/dabr/common/twitter.php b/dabr/common/twitter.php
--- a/dabr/common/twitter.php
+++ b/dabr/common/twitter.php
@@ -154,7 +154,7 @@ function long_url($shortURL)
function friendship_exists($user_a) {
- $request = API_URL.'friendships/show.json?target_screen_name=' . $user_a;
+ $request = API_URL.'friendships/show.json?include_entities=true&target_screen_name=' . $user_a;
$following = twitter_process($request);