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
$html = mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8') |
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
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 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
//rfc 4122 4.4. Algorithms for Creating a UUID from Truly Random or Pseudo-Random Numbers | |
//@author broofa | |
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0,v=c=='x'?r:r&0x3|0x8;return v.toString(16);}); |
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
PicListUrl.split('|').forEach(function(path) { | |
var img = new Image(); | |
img.src = ServerList[server-1]+path; | |
document.body.appendChild(img); | |
}); |
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
1. | |
ssh-keygen -t rsa -f ~/.ssh/id_rsa.work -C "Key for Word stuff" | |
2. | |
touch ~/.ssh/config | |
chmod 600 ~/.ssh/config | |
echo "IdentityFile ~/.ssh/id_rsa.work" >> ~/.ssh/config | |
echo "IdentityFile ~/.ssh/id_rsa.misc" >> ~/.ssh/config | |
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
function(time, local){ | |
(!local) && (local = Date.now()); | |
if (typeof time !== 'number' || typeof local !== 'number') return; | |
var offset = Math.abs((local/1000 - time)), | |
span = [], | |
MINUTE = 60, | |
HOUR = 3600, |
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
find . -exec sudo chown www-data.adm {} \; | |
find . -type d -exec sudo chmod 775 {} \; | |
find . -type f -exec sudo chmod 664 {} \; |
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
var units = ' KMGTPEZYXWVU'; | |
function toHumanSize(bytes) { | |
if (bytes <= 0) { return 0; } | |
var t2 = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), 12); | |
return (Math.round(bytes * 100 / Math.pow(1024, t2)) / 100) + units.charAt(t2).replace(' ', '') + 'B'; | |
} |
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
var template = '<img style="max-width:100%" src=""></img>'; | |
var path = getSLUrl(cuD); | |
$('body').empty(); | |
for(var i=0; i<arrFiles.length; i++) { | |
$(template).attr('src',path+arrFiles[i]).appendTo('body'); | |
} |
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
var template = '<img style="max-width:100%" src=""></img>'; | |
var imgs = PicListUrl.split('|'); | |
$('body').empty(); | |
for(var i=0; i<imgs.length; i++) { | |
$(template).attr('src',ServerList[server-1]+imgs[i]).appendTo('body'); | |
} |