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
| if [[ $# -eq 0 ]] ; then | |
| echo 'You must specify a valid virtual host name' | |
| exit 0 | |
| fi | |
| vhost=$1 | |
| export vhost | |
| sudo mkdir -p /var/www/"$vhost"/public_html | |
| sudo chmod -R 777 /var/www/"$vhost" |
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
| if [[ $# -eq 0 ]] ; then | |
| echo 'You must specify a valid virtual host name' | |
| exit 0 | |
| fi | |
| vhost=$1 | |
| export vhost | |
| sudo rm -rf /var/www/"$vhost" | |
| sudo a2dissite "$vhost".conf |
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
| let fs = require('fs'); | |
| let path = process.cwd(); | |
| console.log('looking for StreamingHistory.json file in ' + path + '\\data\\'); | |
| let buffer = {}; | |
| try { | |
| buffer = fs.readFileSync(path + "\\data\\StreamingHistory.json"); | |
| } catch (e) { |
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
| /* | |
| Variations of https://medium.com/@d0nut/why-building-a-sandbox-in-pure-javascript-is-a-fools-errand-d425b77b2899 | |
| jailbreaking example. | |
| */ | |
| var flag = "I'm the flag!"; | |
| function jail(code) { | |
| // quick string escape for inner strings | |
| code = code.replace(/["'`\\]/g, function(v){ return `\\${v}`}); |
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
| let squeeze = s => s.replace(/../g,c=>String.fromCharCode(c[a='charCodeAt']()|c[a](1)<<7)); | |
| let unsqueeze = s => s.replace(/./g,c=>String.fromCharCode((c=c.charCodeAt())&127,c>>7)); | |
| console.log(unsqueeze("㟦ᑲᝣ㓷㩤㹨㒽Ჽ㒻ᚭᒻ㓦㙬㋒㩣ᨨᠰ㒫ᢪᠰ⦫㨨ᔩᠳᘰᠴᘰᠵᠰᶩ") === | |
| "for(c.width|=i=9;i--;)x.fillRect(400+i*100+S(t)*300,400,50,200);"); | |
| console.log(squeeze("for(c.width|=i=9;i--;)x.fillRect(400+i*100+S(t)*300,400,50,200);") === | |
| "㟦ᑲᝣ㓷㩤㹨㒽Ჽ㒻ᚭᒻ㓦㙬㋒㩣ᨨᠰ㒫ᢪᠰ⦫㨨ᔩᠳᘰᠴᘰᠵᠰᶩ"); | |
| console.log("㟦ᑲᝣ㓷㩤㹨㒽Ჽ㒻ᚭᒻ㓦㙬㋒㩣ᨨᠰ㒫ᢪᠰ⦫㨨ᔩᠳᘰᠴᘰᠵᠰᶩ".length === 32); |
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* sequence(x) { | |
| yield x; | |
| yield * sequence(x + 1); | |
| } |
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
| // recursive infinite generator | |
| p=function*a(x){yield x;yield*a(x+1)}(0) | |
| o={*a(x){yield x;yield*this.a(x+1)}}.a(0) | |
| // using iterators | |
| q=(x=>({next:_=>({value:x++})}))(0) |
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
| // Collection of weird JS snippets | |
| // taking advantage of non-utf chars | |
| thіs.x = 'a' | |
| this.x // error | |
| // taking advantage of regex syntax | |
| /(\/)/gimuy.exec`\/`[-[~[]]] |
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
| e=(m,a,b)=>m.replace(/./g,c=>String.fromCharCode(((c.charCodeAt()-65)*a+b)%26+65)) | |
| d=(m,a,b)=>m.replace(/./g,c=>String.fromCharCode(a*(c.charCodeAt()-39-b)%26+65)) |
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
| `0 7→ 20, 1 7→ 13, 2 7→ 21, 3 7→ 0, 4 7→ 1, 5 7→ 2, 6 7→ 3, 7 7→ 4, 8 7→ 5, | |
| 9 7→ 6, 10 7→ 7, 11 7→ 8, 12 7→ 9, 13 7→ 10, 14 7→ 11, 15 7→ 12, 16 7→ 14, | |
| 17 7→ 15, 18 7→ 16, 19 7→ 17, 20 7→ 18, 21 7→ 19, 22 7→ 22, | |
| 23 7→ 23, 24 7→ 24, 25 7→ 25`.split(',') | |
| .map(v => | |
| v.replace('7→','') | |
| .trim() | |
| .split(' ')) | |
| .map(v=>({[v[1]]:v[0]})) | |
| .reduce((v, acc) => Object.assign(acc,v),{}); |