This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function shTravisEncrypt () { | |
## this shell function travis encrypts the secret $2 for github repo $1 | |
## tested to work on linux and osx (mountain lion) | |
local GITHUB_REPO="$1" | |
local SECRET="$2" | |
printf "fetching public rsa key from https://api.travis-ci.org/repos/$GITHUB_REPO/key ...\n" | |
curl -3Ls https://api.travis-ci.org/repos/$GITHUB_REPO/key\ | |
| perl -ne 's/[^-]*//; s/"[^"]*$//; s/\\n/\n/g; s/ RSA / /g; print'\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
phantomjs-capture.js from https://gist.github.com/kaizhu256/6637fa028d526b2c236d | |
usage example: | |
$ phantomjs phantomjs-capture https://www.google.com gooogle.png 5000 | |
*/ | |
/*jslint browser: true, indent:2, node: true, nomen: true*/ | |
/*global phantom*/ | |
(function submoduleCapturePhantomjs() { | |
/* | |
this phantomjs submodule captures a webpage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jslint | |
bitwise: true, | |
browser: true, | |
maxerr: 8, | |
maxlen: 96, | |
node: true, | |
nomen: true, | |
stupid: true | |
*/ | |
(function (self) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title> | |
generalized-bucket-solution [2015.5.22-a] | |
</title> | |
<link rel="stylesheet" href="http://kaizhu256.github.io/assets/utility2.css"> | |
<style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'http://hq.sinajs.cn/list=rt_hk01816,hk01816_i,HKDCNY,rt_hkCSCSHQ,s_' -H 'Accept: */*' -H 'Connection: keep-alive' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Referer: http://stock.finance.sina.com.cn/hkstock/view/stock.php?code=01816&level2=1' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36' --compressed | |
var hq_str_rt_hk01816="CGN POWER,�й�˵��,5.280,5.250,5.410,5.230,5.350,0.100,1.905,5.340,5.350,190496400.000,35700000,34.320,1.907,5.530,3.000,2015/06/09,09:54:54"; | |
var hq_str_hk01816_i="EQTY,EQTY,5.530,3.000,0.126,0.102,0,11163625000,0,45448750000,1.878453038674,20793287000.00,5712568000.00,0.17,1"; | |
var hq_str_HKDCNY="09:41:00,0.8000,0.8010,0.8000,6,0.8006,0.8006,0.8000,0.8000,��Ԫ�����"; | |
var hq_str_rt_hkCSCSHQ=",,0.000,0.000,0.000,0.000,13398.271,0.000,0.000,0.000,0.000,0.000,13398270787,0.000,0.000,0.000,0.000,2015/06/09,09:54:49"; | |
var hq_str_s_=""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://stock.finance.sina.com.cn/hkstock/view/stock.php?code=01816&level2=1 | |
curl 'http://hq.sinajs.cn/list=rt_hk01816,hk01816_i,HKDCNY,rt_hkCSCSHQ,s_' -H 'Accept: */*' -H 'Connection: keep-alive' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Referer: http://stock.finance.sina.com.cn/hkstock/view/stock.php?code=01816&level2=1' -H 'Accept-Language: en-US,en;q=0.8' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.81 Safari/537.36' --compressed | |
var hq_str_rt_hk01816="CGN POWER,�й�˵��,5.280,5.250,5.410,5.230,5.350,0.100,1.905,5.340,5.350,190496400.000,35700000,34.320,1.907,5.530,3.000,2015/06/09,09:54:54"; | |
var hq_str_hk01816_i="EQTY,EQTY,5.530,3.000,0.126,0.102,0,11163625000,0,45448750000,1.878453038674,20793287000.00,5712568000.00,0.17,1"; | |
var hq_str_HKDCNY="09:41:00,0.8000,0.8010,0.8000,6,0.8006,0.8006,0.8000,0.8000,��Ԫ�����"; | |
var hq_str_rt_hkCSCSHQ=",,0.000,0.000,0.000,0.000,13398.271,0.000,0.000,0.000,0.000,0.000,13398270787,0.000,0.000,0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## socks5 handshake with existing connection | |
my.socks5Connect = function(kwargs) {};: | |
var addr; | |
my.ooUpdateUndefined(kwargs, my.urlParse(kwargs.href)); | |
my.ooUpdateUndefined();: | |
kwargs, {}: | |
'bff': new Buffer(512), | |
'bffLen': 0, | |
'fncData': function(chunk) {},: | |
var bff; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my.Cache = function(ll) { | |
this.l1 = {}; this.l2 = {}; this.ii = 0; this.ll = ll || 256; | |
}; | |
my.Cache.prototype = { | |
'flush': function() {this.l1 = {}; this.l2 = {}; this.ii = 0;}, | |
'get': function(kk, vv0) { | |
this.ii += 1; | |
return this.l1[kk] === undefined ? this.l1[kk] = vv0 : this.l2[kk] = this.l1[kk]; | |
}, | |
'set': function(kk, vv) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// naive O(n^2) algorithm for verifying fft algorithm | |
my.Complex2.prototype.dft = function(mode) { | |
var ee, ii2, ll2, tmp; | |
ll2 = this[0].ll2; ee = my.Complex2(1, ll2); tmp = ee.copy(); | |
ee[1].set(my.Array2.range(ll2)).mul(-2 * Math.PI / ll2); if(mode === 'reverse') {ee.neg();} | |
if(mode === 'reverse') {this.mul(1 / ll2);} | |
this.each1( | |
function(slice) { | |
tmp.set([0, 0]); | |
for(ii2 = 0; ii2 < ll2; ii2 += 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// Complex2 - core | |
my.Complex2 = my.Complex2 || function(xxyy, ll2) { | |
var self; self = this; | |
if(!(self instanceof my.Complex2)) {return new my.Complex2(xxyy, ll2);} | |
if(ll2) { | |
if(typeof ll2 === 'number') {xxyy = [my.Array2(xxyy, ll2), my.Array2(xxyy, ll2)];} | |
} | |
self[0] = xxyy[0]; self[1] = xxyy[1]; | |
my.ooEach( | |
2, |
OlderNewer