Skip to content

Instantly share code, notes, and snippets.

View yyfrankyy's full-sized avatar

Frank Xu yyfrankyy

View GitHub Profile
@yyfrankyy
yyfrankyy / Output
Created May 3, 2012 06:44
spm的分段打包
a.js:2b.js run from a
c.js:2I'm D
c.js:2d.js run from c
c.js:1c.js run from async c
; The entire ECMAScript grammar expressed as a single PEG
; Parser rules which share a name with ECMA-262 productions are intended to match the same language.
Program ←
(S? (Statement / FunctionDeclaration))* S?
FunctionBody ←
(S? (Statement / FunctionDeclaration))* S?
@yyfrankyy
yyfrankyy / file_ext_statistics.sh
Created April 20, 2012 10:42
count the file extensions
basename `find . -path '*/.svn*' -prune -o -print` | awk -F . '{print $NF}' | sort | uniq -c | sort
@yyfrankyy
yyfrankyy / build.sh
Created March 16, 2012 08:41
Cross Compile Script for leptonlib-1.67 and tessesact-3.01
#!/bin/sh
# modified from http://tinsuke.wordpress.com/2011/02/17/how-to-cross-compiling-libraries-for-ios-armv6armv7i386/
GLOBAL_OUTDIR="`pwd`/dependencies"
OUTDIR="./outdir"
LEPTON_LIB="`pwd`/leptonlib-1.67"
TESSERACT_LIB="`pwd`/tesseract-3.01"
IOS_BASE_SDK="5.1"
IOS_DEPLOY_TGT="4.1"
@yyfrankyy
yyfrankyy / connectToWifi.scpt
Created February 29, 2012 04:56
Connect To WiFi
tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
set menuExtras to (value of attribute "AXChildren")
set wifi to -1
repeat with wifiMenu in menuExtras
tell wifiMenu
if value of attribute "AXDescription" contains "Wi-Fi" then
set wifi to wifiMenu
exit repeat
; http://boshi.inimino.org/3box/asof/1270029991384/PEG/ECMAScript_unified.peg
; The entire ECMAScript grammar expressed as a single PEG
; Parser rules which share a name with ECMA-262 productions are intended to match the same language.
Program ←
(S? (Statement / FunctionDeclaration))* S?
FunctionBody ←
@yyfrankyy
yyfrankyy / download_untar.sh
Created December 29, 2011 08:52
download from github's private repo
curl -sLk --user {username}:{password} https://github.com/{username}/{repo}/tarball/{tagname} | tar -xzf -
@yyfrankyy
yyfrankyy / huaban.js
Created December 21, 2011 08:34
批量获取花瓣大图的地址。
var http = require('http');
var url = require('url');
var _ = require('underscore');
var util = require('util');
var base = 'http://huaban.com/boards/';
var huaban = function(board) {
var self = this;
self.max = '';
@yyfrankyy
yyfrankyy / gbkUriDecode.js
Created November 17, 2011 10:52
gbkUriDecode
// npm install iconv
var gbk2utf8 = new (require('iconv').Iconv)('GBK', 'UTF8');
function gbkUriDecode(content) {
return content.replace(/%(\w\w)%(\w\w)/g, function(source, g1, g2) {
return gbk2utf8(new Buffer(g1 + g2, 'hex')).toString();
});
};
@yyfrankyy
yyfrankyy / jsonp-proxy.js
Created September 9, 2011 15:46
JSONP Proxy
// vim: set ts=2 sw=2:
var express = require('express');
var http = require('http');
var url = require('url');
var xml2json = require('xml2json');
var slideshare = require('./slideshare');
var app = express.createServer();