Skip to content

Instantly share code, notes, and snippets.

View mcxiaoke's full-sized avatar

Hello World mcxiaoke

  • Earth
View GitHub Profile
@mcxiaoke
mcxiaoke / google-chrome-config
Created April 29, 2011 11:16
google-chrome-config
#:~/.config/google-chrome/Defaul/Preferences
#在此文件中修改最后一段如下:
"webkit": {
"webprefs": {
"default_fixed_font_size": 14,
"default_font_size": 16,
"fixed_font_family": "Monospace",
"minimum_font_size": 12,
"sansserif_font_family": "Sans",
@mcxiaoke
mcxiaoke / gist:956493
Created May 5, 2011 03:37 — forked from Pretz/gist:822036
xAuth in Android for Instapaper using Signpost
protected String[] doInBackground(String... credentials) {
String consumer_secret = mActivity.getString(R.string.oauth_consumer_secret);
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost("https://www.instapaper.com/api/1/oauth/access_token");
CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(mActivity.getString(R.string.oauth_consumer_key),
consumer_secret);
List<BasicNameValuePair> params = Arrays.asList(
new BasicNameValuePair("x_auth_username", credentials[0]),
new BasicNameValuePair("x_auth_password", credentials[1]),
new BasicNameValuePair("x_auth_mode", "client_auth"));
@mcxiaoke
mcxiaoke / notify.js
Created May 25, 2011 14:57
stream-twitter.js
var params = new Object();
var id;
var closeTimer;
var text = "";
var textOrig;
var entities;
var tweet;
var timeOut = 1000 * localStorage.getItem("timeout");
$(document).ready(function() {
paramsIn = window.location.href.split("?"); paramsIn = paramsIn[1].split("&") || null; for(var a in paramsIn) {
@mcxiaoke
mcxiaoke / README
Created November 25, 2011 06:09
饭否头像墙头像查找
首先下载一个头像墙,将其拉伸/压缩以使所有的头像长宽均为整数;
然后将文件信息和头像长宽填入 consts.py 内;
使用 hashall.py 生成 hashes.dat 文件;
使用 testone.py x.jpg 测试头像是否在头像墙内,
testone.py 会将头像墙中最接近的一个头像保存在 result.png,
同时在标准输出输出一行信息,格式为 (差异度, 位置),
实验表明,差异度小于(不等于)5大体上可以认为是相同的。
@mcxiaoke
mcxiaoke / gist:1421976
Created December 2, 2011 05:56 — forked from HungYuHei/gist:1235143
vpn-ip
# max-routes 600
route 1.51.0.0 255.255.0.0 net_gateway
route 1.184.0.0 255.254.0.0 net_gateway
route 27.148.0.0 255.252.0.0 net_gateway
route 49.52.0.0 255.252.0.0 net_gateway
route 49.120.0.0 255.252.0.0 net_gateway
route 49.140.0.0 255.254.0.0 net_gateway
route 49.208.0.0 255.254.0.0 net_gateway
route 58.17.0.0 255.255.0.0 net_gateway
route 58.18.0.0 255.254.0.0 net_gateway
@mcxiaoke
mcxiaoke / gist:1484055
Created December 16, 2011 01:54 — forked from Gozala/gist:564751
snippet for the blog post
txtblk='\033[0;30m' # Black - Regular
txtred='\033[0;31m' # Red
txtgrn='\033[0;32m' # Green
txtylw='\033[0;33m' # Yellow
txtblu='\033[0;34m' # Blue
txtpur='\033[0;35m' # Purple
txtcyn='\033[0;36m' # Cyan
txtwht='\033[0;37m' # White
bldblk='\033[1;30m' # Black - Bold
bldred='\033[1;31m' # Red
@mcxiaoke
mcxiaoke / lisp.rb
Created January 30, 2012 14:06 — forked from dahlia/lisp.rb
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
@mcxiaoke
mcxiaoke / gist:1834008
Created February 15, 2012 07:18 — forked from Pretz/gist:822036
xAuth in Android for Instapaper using Signpost
protected String[] doInBackground(String... credentials) {
String consumer_secret = mActivity.getString(R.string.oauth_consumer_secret);
HttpClient client = new DefaultHttpClient();
HttpPost request = new HttpPost("https://www.instapaper.com/api/1/oauth/access_token");
CommonsHttpOAuthConsumer consumer = new CommonsHttpOAuthConsumer(mActivity.getString(R.string.oauth_consumer_key),
consumer_secret);
List<BasicNameValuePair> params = Arrays.asList(
new BasicNameValuePair("x_auth_username", credentials[0]),
new BasicNameValuePair("x_auth_password", credentials[1]),
new BasicNameValuePair("x_auth_mode", "client_auth"));
@mcxiaoke
mcxiaoke / OAUTHnesia.java
Created February 17, 2012 05:22 — forked from tistaharahap/OAUTHnesia.java
OAUTHnesia for Android Java
/**
* OAUTHnesia for Java Android Class
*
* @package OAUTHnesia
* @subpackage Java Android
* @category OAUTH Client
* @author Batista R. Harahap <[email protected]>
* @link http://www.bango29.com
* @license MIT License - http://www.opensource.org/licenses/mit-license.php
*
@mcxiaoke
mcxiaoke / OAuthActivity.java
Created February 17, 2012 06:36 — forked from lethargicpanda/OAuthActivity.java
OAuthActivity implements OAuth logg in in your Android application
public class OAuthActivity extends Activity {
public static String OAUTH_URL = "https://github.com/login/oauth/authorize";
public static String OAUTH_ACCESS_TOKEN_URL = "https://github.com/login/oauth/access_token";
public static String CLIENT_ID = "YOUR_CLIENT_ID";
public static String CLIENT_SECRET = "YOUR_CLIENT_SECRET";
public static String CALLBACK_URL = "http://localhost";
@Override