This file contains hidden or 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
server { | |
listen 80; | |
server_name www.playwithproxy.tw; | |
location / { | |
proxy_pass http://10.0.0.201; | |
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; | |
proxy_redirect off; | |
proxy_buffering off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; |
This file contains hidden or 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
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8') |
This file contains hidden or 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
/* For a given date, get the ISO week number | |
* | |
* Based on information at: | |
* | |
* http://www.merlyn.demon.co.uk/weekcalc.htm#WNR | |
* | |
* Algorithm is to find nearest thursday, it's year | |
* is the year of the week number. Then get weeks | |
* between that date and the first day of that year. | |
* |
This file contains hidden or 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
// | |
// [1].dim() == 1 | |
// [1,2].dim() == 1 | |
// [[1]].dim() == 2 | |
// [[1,2,3],4,[5,6,7],[8,9,0]].dim() == 2 | |
// [[1,[2]],3,[[4,5],6,[7,8]]].dim() == 3 | |
// | |
Array.prototype.dim = function dim() { | |
return this.reduce(function(a,b) { |
This file contains hidden or 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
(Math.random().toString(16) + '000000').slice(2, 8) |
This file contains hidden or 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
function parseLink(link) { | |
var links = {} | |
link.split(/\s*,\s*(?=<)/).forEach(function(l, i) { | |
var parts = l.match(/(?:<(\S+)>; rel="(\S*)",?)/) | |
if(parts.length == 3) { | |
links[parts[2]] = parts[1] | |
} | |
}) | |
return links; | |
} |
This file contains hidden or 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
echo 'flush_all' | nc localhost 11211 |
This file contains hidden or 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
time rsync -aOvz sandbox-02:/var/benchmark/ ~/benchmark |
This file contains hidden or 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
git clone git://anongit.kde.org/kcachegrind | |
cd kcachegrind/qcachegrind | |
qmake -spec 'macx-g++'; make |
This file contains hidden or 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
mongod --config /usr/local/etc/mongod.conf |