Browse files

Improvements regarding the sandbox and enforce new policy.

Remove excess code in JavaScript sandbox script
Increase sandbox timeout to 4 seconds
Kick sephr when he tells people to wait.
  • Loading branch information...
1 parent 54d94ea commit 4366288f4b6d51e030fd1cd19d38deb35db0ff38 @dsamarin dsamarin committed Apr 21, 2012
Showing with 60 additions and 686 deletions.
  1. +45 −12 oftnbot-factoids.json
  2. +0 −670 oftnbot-utils.js
  3. +14 −3 oftnbot.js
  4. +1 −1 shared.js
View
57 oftnbot-factoids.json
@@ -57,7 +57,7 @@
},
"help": {
"value": "For help using oftn-bot, see <https://github.com/oftn/oftn-bot/wiki/Guide-to-oftn-bot>",
- "popularity": 24
+ "popularity": 25
},
"board": {
"value": "The ΩF:∅ Foundation Board of Directors: cloudhead, eboyjr, sephr, gkatsev, GothAlice, devyn, inimino, and yrashk",
@@ -71,15 +71,15 @@
"popularity": 4
},
"kirby": {
- "value": "<(^-^<) <(^-^)> (>^-^)>",
- "popularity": 4
+ "value": "<(n_n<) <(n_n)> (>n_n)>",
+ "popularity": 5
},
"recursion": {
"value": "See !recursion"
},
"test": {
"value": "Error: Failure while printing test status.",
- "popularity": 67
+ "popularity": 69
},
"specgen": {
"value": "Anolis <http://anolis.gsnedders.com/>",
@@ -109,9 +109,6 @@
"value": "How horrible! I don't know what I'll do with myself without you, eboyjr or sephr!",
"popularity": 6
},
- "androide": {
- "value": "An IDE for Android. People working on it: sephr, gkatsev, and not eboyjr."
- },
"irc modes": {
"value": "<http://webtoman.com/opera/panel/ircdmodes.html>",
"popularity": 0
@@ -167,7 +164,7 @@
},
"oftn": {
"value": "The ΩF:∅ Foundation creates and maintains free and open-source software.",
- "popularity": 2
+ "popularity": 3
},
"hammertime": {
"value": "━━▊ ━━▊ ━━▊",
@@ -244,12 +241,12 @@
"popularity": 1
},
"post hook": {
- "value": "The Github Post-Receive Hook URL for all ΩF:∅ repositories is: http://eboyjr.oftn.org:9370/oftn",
- "popularity": 1
+ "value": "The Github Post-Receive Hook URL for oftn-bot is: http://eboyjr.oftn.org:9370/<uri-escaped-channel>",
+ "popularity": 3
},
"donate": {
"value": "https://www.wepay.com/donate/oftn",
- "popularity": 0
+ "popularity": 1
},
"facebook": {
"value": "https://www.facebook.com/oftn.foundation",
@@ -264,7 +261,7 @@
"popularity": 1
},
"default topic": {
- "value": "The ΩF:∅ Foundation - The league of open-source software beaux esprits - http://oftn.org - mumble://talk.oftn.org",
+ "value": "The ΩF:∅ Foundation - The league of open-source software beaux esprits - http://oftn.org - http://oftn.titanpad.com/ - mumble://talk.oftn.org",
"popularity": 1
},
"usage": {
@@ -276,6 +273,42 @@
"logs": {
"value": "Some logs of this channel are hosted by eboy at http://eboyjr.oftn.org:8080/files/irclogs/freenode/ in #oftn.log files.",
"popularity": 0
+ },
+ "api design": {
+ "value": "When designing an interface, imagine that your program is all that stands between the user and hot, sweaty, tangled-bedsheets-fingertips-digging-into-the-back sex. <http://xkcd.com/196/>",
+ "popularity": 0
+ },
+ "it works": {
+ "value": "It works it works! Omg omg omg! I mean it compiles. Now what's a segfault?",
+ "popularity": 1
+ },
+ "important": {
+ "value": "Spelling and capitalization are important in programming, unless you are using PHP.",
+ "popularity": 3
+ },
+ "o4o": {
+ "value": "Some topics are controversial and often end in negativity. Take care on subjects like war, race, religion, politics, gender, sexuality, drugs, potentially illegal activities and suicide. The topics are not banned; stating your position is ok, but trolling, baiting, hostility or repetition are not. If you are asked to stop, do so politely, or move to #oftn-offtopic.",
+ "popularity": 0
+ },
+ "status nuck": {
+ "value": "porning",
+ "popularity": 0
+ },
+ "csi": {
+ "value": "YEEAAAAAAAAAAAAAAAH <http://mirrors.rit.edu/instantCSI/>",
+ "popularity": 0
+ },
+ "new projects": {
+ "value": "We welcome all new projects to the ΩF:∅ Foundation. To start a new one, tell a board member 1) the name of the project, 2) project description [optional], and 3) which ΩF:∅ members are also going to be working on this project. Also ask about setting up a web page at <http://oftn.org/>.",
+ "popularity": 0
+ },
+ "designers": {
+ "value": "1) entropy- alex@entropyirc.net [cheesy rounded corners] 2) oksushi #css-lance [professional, busy] 3) jedimind http://pud.ca/ [commercial, probably expensive]",
+ "popularity": 0
+ },
+ "gods": {
+ "value": "locks",
+ "popularity": 0
}
}
}
View
670 oftnbot-utils.js
@@ -21,121 +21,6 @@ global.print = global.alert = global.console.log;
global.version = typeof version === "undefined" ? "unknown" : version;
-function constant_multiply(n) {
- n |= 0;
- if (n === 0) return '0';
- var bits = n.toString(2).split("").map(function(b){return b=='1'}).reverse();
- var addops = [];
- for (var i = bits.length-1; i >= 0; i--) {
- if (bits[i]) addops.push(i?"(a << "+i+")":"a");
- }
- return addops.join(" + ");
-}
-
-function constant_divide(n) {
- n |= 0;
- if (n === 0) {
- throw new Error("Cannot divide by zero!");
- } else if (n === 1) {
- return "a";
- } else if ((n & (n - 1)) === 0) {
- // If n is power of two
- return n?"(a << "+(Math.log(n) + 1 |0)+")":"a";
- } else {
- n = (1/n*65535) | 0;
- var bits = n.toString(2).split("").map(function(b){return b=='1'}).reverse();
- bits[0] = true; // I don't exactly know how I came to add this, but it works
- var addops = [];
- for (var i = bits.length-1; i >= 0; i--) {
- if (bits[i]) addops.push(i?"(a << "+i+")":"a");
- }
- return "("+addops.join(" + ")+") >> 16";
- }
-}
-
-function numbers_that_add_and_subtract_to (sum, dif)
-{
- var b = (sum - dif) / 2;
- var a = dif + b;
- return [a, b];
-}
-
-function numbers_that_add_and_multiply_to (sum, product)
-{
- var a = (sum + Math.sqrt(sum*sum - 4*product)) / 2;
- if (isNaN(a)) throw new Error("No real solution");
- return [a, sum - a];
-}
-
-
-global.constant_multiply = constant_multiply;
-global.constant_divide = constant_divide;
-global.numbers_that_add_and_subtract_to = numbers_that_add_and_subtract_to;
-global.numbers_that_add_and_multiply_to = numbers_that_add_and_multiply_to;
-
-global.obfuscate = function obfuscate(val) {
- val = String(val);
- return val.replace(/[a-z]{4,}/ig, function(s) {
- return s.charAt(0)+Array.prototype.slice.call(s, 1, -1).reverse().join("")+s.charAt(s.length-1);
- });
-};
-
-global.strip_color = function strip_color(text) {
- text = String(text);
- return text.replace(/\x03\d{0,2},?\d{1,2}|[\x02\x06\x07\x16\x17\x1b\x1d\x1f\x0f]/g, '');
-};
-
-global.braille = function braille(text) {
- "use strict";
-
- text = String(text);
- var i = 0,
- result = [],
- err = [],
- len = text.length,
- ch,
- alphanum = "⠁⠃⠉⠙⠑⠋⠛⠓⠊⠚⠅⠇⠍⠝⠕⠏⠟⠗⠎⠞⠥⠧⠺⠭⠽⠵";
-
- while (i < len) {
- ch = text.charCodeAt(i++);
- if (ch >= 65 && ch <= 90) {
- result.push("" + alphanum[ch - 65]);
- } else if (ch >= 97 && ch <= 122) {
- result.push(alphanum[ch - 97]);
- } else if (ch >= 48 && ch <= 57) {
- result.push("");
- do {
- result.push(ch === 48 ? alphanum[10] : alphanum[ch - 49]);
- ch = text.charCodeAt(i++);
- } while (ch >= 48 && ch <= 57);
- i--;
- } else {
- switch (ch) {
- case 32:
- result.push(" "); break;
- case 39:
- result.push(""); break;
- case 46:
- result.push(""); break;
- case 44:
- result.push(""); break;
- case 59:
- result.push(""); break;
- case 33:
- result.push(""); break;
- case 45:
- result.push(""); break;
- default:
- err.push(String.fromCharCode(ch));
- }
- }
- }
- if (err.length) {
- global.console.log("Could not convert: " + err.join(""));
- }
- return result.join("");
-};
-
/**
* Pretty-prints a Javascript value for viewing.
* Identifies circular references
@@ -397,558 +282,3 @@ exports.run = function(execute) {
};
exports.pretty_print = utils.pretty_print;
exports.string_format = utils.string_format;
-
-/**
- * The following are standard functions from common/ used for testing.
- **/
-
-if (typeof ArrayBuffer !== "undefined") {
-
-var Base64 = {
-
- rank: new Uint8Array([
- 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1
- , -1, -1, 0, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
- , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25
- , -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35
- , 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
- ]),
-
- alphabet: new Uint8Array([
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80
- , 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99,100,101,102
- ,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118
- ,119,120,121,122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47
- ]),
-
- encode: function(data, byteOffset, byteLength) {
- "use strict";
-
- if (Object.prototype.toString.call(data) !== "[object ArrayBuffer]")
- throw new TypeError("First argument must be an ArrayBuffer");
-
- byteOffset >>>= 0;
- byteLength = (typeof byteLength !== "undefined" ?
- byteLength >>> 0 : data.byteLength - byteOffset);
-
- var
- alphabet = Base64.alphabet
- , input = new Uint8Array(data, byteOffset, byteLength)
- , output = new Uint8Array((byteLength / 3 + 1) * 4 | 0)
- , ip = 0
- , op = 0
- , buffer = [0, 0, 0]
- , size
- , code;
-
- while (byteLength) {
-
- size = 0;
-
- for (var a = 0; a < 3; a++) {
- if (byteLength) {
- size++;
- byteLength--;
- buffer[a] = input[ip++];
- } else {
- buffer[a] = 0;
- }
- }
-
- if (size) {
- output[op++] = alphabet[buffer[0] >> 2];
- output[op++] =
- alphabet[((buffer[0] & 0x03) << 4) |
- ((buffer[1] & 0xf0) >> 4)];
- output[op++] = (size > 1 ?
- alphabet[((buffer[1] & 0x0f) << 2) |
- ((buffer[2] & 0xc0) >> 6)] : 61);
- output[op++] = (size > 2 ?
- alphabet[buffer[2] & 0x3f] : 61);
- }
- }
-
- return output.subarray(0, op);
- },
-
- decode: function(base64) {
- "use strict";
-
- var
- len = base64.length
- , buffer = new Uint8Array(len / 4 * 3 | 0)
- , ranks = Base64.rank
- , i = 0
- , outptr = 0
- , last = [0, 0]
- , state = 0
- , save = 0
- , rank
- , code;
-
- while (len--) {
- code = base64[i++];
- rank = ranks[code-43];
- if (rank !== 255 && rank !== void 0) {
- last[1] = last[0];
- last[0] = code;
- save = (save << 6) | rank;
- state++;
- if (state === 4) {
- buffer[outptr++] = save >>> 16;
- if (last[1] !== 61 /* padding character */) {
- buffer[outptr++] = save >>> 8;
- }
- if (last[0] !== 61 /* padding character */) {
- buffer[outptr++] = save;
- }
- state = 0;
- }
- }
- }
- return buffer.subarray(0, outptr);
- }
-};
-
-
-var MD5 = function(data, byteOffset, byteLength) {
- "use strict";
-
- if (Object.prototype.toString.call(data) !== "[object ArrayBuffer]")
- throw new TypeError("First argument must be an ArrayBuffer");
-
- byteOffset >>>= 0;
- byteLength = (typeof byteLength !== "undefined" ?
- byteLength >>> 0 : data.byteLength - byteOffset);
-
- var
- checksum_h = new Uint32Array([0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476])
- , input = data
- , input_trailing = byteLength & 63
- , block_offset = byteOffset
- , block_num = (byteLength + 9) / 64 + 1 | 0
- , block_i = 0
- , i_uint8
- , i, b;
-
- while (block_num--) {
-
- if (block_offset + 64 > byteLength) {
-
- i = new Uint32Array(16);
- i_uint8 = Uint8Array(i.buffer);
-
- if (input_trailing > 0) {
- i_uint8.set(Uint8Array(input, block_offset, input_trailing));
- }
-
- if (input_trailing >= 0) {
- i_uint8[input_trailing] |= 0x80;
- }
-
- if (!block_num) {
- i[14] = byteLength << 3;
- } else {
- input_trailing -= 64;
- }
-
- } else {
- i = new Uint32Array(input, block_offset, 16);
- }
-
- b = new Uint32Array(checksum_h);
- block_offset += 64;
-
- b[0] += (b[3] ^ (b[1] & (b[2] ^ b[3]))) + (i[0] + 0xd76aa478 >>> 0); b[0] = b[0] << 7 | b[0] >>> 25; b[0] += b[1];
- b[3] += (b[2] ^ (b[0] & (b[1] ^ b[2]))) + (i[1] + 0xe8c7b756 >>> 0); b[3] = b[3] << 12 | b[3] >>> 20; b[3] += b[0];
- b[2] += (b[1] ^ (b[3] & (b[0] ^ b[1]))) + (i[2] + 0x242070db >>> 0); b[2] = b[2] << 17 | b[2] >>> 15; b[2] += b[3];
- b[1] += (b[0] ^ (b[2] & (b[3] ^ b[0]))) + (i[3] + 0xc1bdceee >>> 0); b[1] = b[1] << 22 | b[1] >>> 10; b[1] += b[2];
- b[0] += (b[3] ^ (b[1] & (b[2] ^ b[3]))) + (i[4] + 0xf57c0faf >>> 0); b[0] = b[0] << 7 | b[0] >>> 25; b[0] += b[1];
- b[3] += (b[2] ^ (b[0] & (b[1] ^ b[2]))) + (i[5] + 0x4787c62a >>> 0); b[3] = b[3] << 12 | b[3] >>> 20; b[3] += b[0];
- b[2] += (b[1] ^ (b[3] & (b[0] ^ b[1]))) + (i[6] + 0xa8304613 >>> 0); b[2] = b[2] << 17 | b[2] >>> 15; b[2] += b[3];
- b[1] += (b[0] ^ (b[2] & (b[3] ^ b[0]))) + (i[7] + 0xfd469501 >>> 0); b[1] = b[1] << 22 | b[1] >>> 10; b[1] += b[2];
- b[0] += (b[3] ^ (b[1] & (b[2] ^ b[3]))) + (i[8] + 0x698098d8 >>> 0); b[0] = b[0] << 7 | b[0] >>> 25; b[0] += b[1];
- b[3] += (b[2] ^ (b[0] & (b[1] ^ b[2]))) + (i[9] + 0x8b44f7af >>> 0); b[3] = b[3] << 12 | b[3] >>> 20; b[3] += b[0];
- b[2] += (b[1] ^ (b[3] & (b[0] ^ b[1]))) + (i[10] + 0xffff5bb1 >>> 0); b[2] = b[2] << 17 | b[2] >>> 15; b[2] += b[3];
- b[1] += (b[0] ^ (b[2] & (b[3] ^ b[0]))) + (i[11] + 0x895cd7be >>> 0); b[1] = b[1] << 22 | b[1] >>> 10; b[1] += b[2];
- b[0] += (b[3] ^ (b[1] & (b[2] ^ b[3]))) + (i[12] + 0x6b901122 >>> 0); b[0] = b[0] << 7 | b[0] >>> 25; b[0] += b[1];
- b[3] += (b[2] ^ (b[0] & (b[1] ^ b[2]))) + (i[13] + 0xfd987193 >>> 0); b[3] = b[3] << 12 | b[3] >>> 20; b[3] += b[0];
- b[2] += (b[1] ^ (b[3] & (b[0] ^ b[1]))) + (i[14] + 0xa679438e >>> 0); b[2] = b[2] << 17 | b[2] >>> 15; b[2] += b[3];
- b[1] += (b[0] ^ (b[2] & (b[3] ^ b[0]))) + (i[15] + 0x49b40821 >>> 0); b[1] = b[1] << 22 | b[1] >>> 10; b[1] += b[2];
-
- b[0] += (b[2] ^ (b[3] & (b[1] ^ b[2]))) + (i[1] + 0xf61e2562 >>> 0); b[0] = b[0] << 5 | b[0] >>> 27; b[0] += b[1];
- b[3] += (b[1] ^ (b[2] & (b[0] ^ b[1]))) + (i[6] + 0xc040b340 >>> 0); b[3] = b[3] << 9 | b[3] >>> 23; b[3] += b[0];
- b[2] += (b[0] ^ (b[1] & (b[3] ^ b[0]))) + (i[11] + 0x265e5a51 >>> 0); b[2] = b[2] << 14 | b[2] >>> 18; b[2] += b[3];
- b[1] += (b[3] ^ (b[0] & (b[2] ^ b[3]))) + (i[0] + 0xe9b6c7aa >>> 0); b[1] = b[1] << 20 | b[1] >>> 12; b[1] += b[2];
- b[0] += (b[2] ^ (b[3] & (b[1] ^ b[2]))) + (i[5] + 0xd62f105d >>> 0); b[0] = b[0] << 5 | b[0] >>> 27; b[0] += b[1];
- b[3] += (b[1] ^ (b[2] & (b[0] ^ b[1]))) + (i[10] + 0x02441453 >>> 0); b[3] = b[3] << 9 | b[3] >>> 23; b[3] += b[0];
- b[2] += (b[0] ^ (b[1] & (b[3] ^ b[0]))) + (i[15] + 0xd8a1e681 >>> 0); b[2] = b[2] << 14 | b[2] >>> 18; b[2] += b[3];
- b[1] += (b[3] ^ (b[0] & (b[2] ^ b[3]))) + (i[4] + 0xe7d3fbc8 >>> 0); b[1] = b[1] << 20 | b[1] >>> 12; b[1] += b[2];
- b[0] += (b[2] ^ (b[3] & (b[1] ^ b[2]))) + (i[9] + 0x21e1cde6 >>> 0); b[0] = b[0] << 5 | b[0] >>> 27; b[0] += b[1];
- b[3] += (b[1] ^ (b[2] & (b[0] ^ b[1]))) + (i[14] + 0xc33707d6 >>> 0); b[3] = b[3] << 9 | b[3] >>> 23; b[3] += b[0];
- b[2] += (b[0] ^ (b[1] & (b[3] ^ b[0]))) + (i[3] + 0xf4d50d87 >>> 0); b[2] = b[2] << 14 | b[2] >>> 18; b[2] += b[3];
- b[1] += (b[3] ^ (b[0] & (b[2] ^ b[3]))) + (i[8] + 0x455a14ed >>> 0); b[1] = b[1] << 20 | b[1] >>> 12; b[1] += b[2];
- b[0] += (b[2] ^ (b[3] & (b[1] ^ b[2]))) + (i[13] + 0xa9e3e905 >>> 0); b[0] = b[0] << 5 | b[0] >>> 27; b[0] += b[1];
- b[3] += (b[1] ^ (b[2] & (b[0] ^ b[1]))) + (i[2] + 0xfcefa3f8 >>> 0); b[3] = b[3] << 9 | b[3] >>> 23; b[3] += b[0];
- b[2] += (b[0] ^ (b[1] & (b[3] ^ b[0]))) + (i[7] + 0x676f02d9 >>> 0); b[2] = b[2] << 14 | b[2] >>> 18; b[2] += b[3];
- b[1] += (b[3] ^ (b[0] & (b[2] ^ b[3]))) + (i[12] + 0x8d2a4c8a >>> 0); b[1] = b[1] << 20 | b[1] >>> 12; b[1] += b[2];
-
- b[0] += (b[1] ^ b[2] ^ b[3]) + (i[5] + 0xfffa3942 >>> 0); b[0] = b[0] << 4 | b[0] >>> 28; b[0] += b[1];
- b[3] += (b[0] ^ b[1] ^ b[2]) + (i[8] + 0x8771f681 >>> 0); b[3] = b[3] << 11 | b[3] >>> 21; b[3] += b[0];
- b[2] += (b[3] ^ b[0] ^ b[1]) + (i[11] + 0x6d9d6122 >>> 0); b[2] = b[2] << 16 | b[2] >>> 16; b[2] += b[3];
- b[1] += (b[2] ^ b[3] ^ b[0]) + (i[14] + 0xfde5380c >>> 0); b[1] = b[1] << 23 | b[1] >>> 9; b[1] += b[2];
- b[0] += (b[1] ^ b[2] ^ b[3]) + (i[1] + 0xa4beea44 >>> 0); b[0] = b[0] << 4 | b[0] >>> 28; b[0] += b[1];
- b[3] += (b[0] ^ b[1] ^ b[2]) + (i[4] + 0x4bdecfa9 >>> 0); b[3] = b[3] << 11 | b[3] >>> 21; b[3] += b[0];
- b[2] += (b[3] ^ b[0] ^ b[1]) + (i[7] + 0xf6bb4b60 >>> 0); b[2] = b[2] << 16 | b[2] >>> 16; b[2] += b[3];
- b[1] += (b[2] ^ b[3] ^ b[0]) + (i[10] + 0xbebfbc70 >>> 0); b[1] = b[1] << 23 | b[1] >>> 9; b[1] += b[2];
- b[0] += (b[1] ^ b[2] ^ b[3]) + (i[13] + 0x289b7ec6 >>> 0); b[0] = b[0] << 4 | b[0] >>> 28; b[0] += b[1];
- b[3] += (b[0] ^ b[1] ^ b[2]) + (i[0] + 0xeaa127fa >>> 0); b[3] = b[3] << 11 | b[3] >>> 21; b[3] += b[0];
- b[2] += (b[3] ^ b[0] ^ b[1]) + (i[3] + 0xd4ef3085 >>> 0); b[2] = b[2] << 16 | b[2] >>> 16; b[2] += b[3];
- b[1] += (b[2] ^ b[3] ^ b[0]) + (i[6] + 0x04881d05 >>> 0); b[1] = b[1] << 23 | b[1] >>> 9; b[1] += b[2];
- b[0] += (b[1] ^ b[2] ^ b[3]) + (i[9] + 0xd9d4d039 >>> 0); b[0] = b[0] << 4 | b[0] >>> 28; b[0] += b[1];
- b[3] += (b[0] ^ b[1] ^ b[2]) + (i[12] + 0xe6db99e5 >>> 0); b[3] = b[3] << 11 | b[3] >>> 21; b[3] += b[0];
- b[2] += (b[3] ^ b[0] ^ b[1]) + (i[15] + 0x1fa27cf8 >>> 0); b[2] = b[2] << 16 | b[2] >>> 16; b[2] += b[3];
- b[1] += (b[2] ^ b[3] ^ b[0]) + (i[2] + 0xc4ac5665 >>> 0); b[1] = b[1] << 23 | b[1] >>> 9; b[1] += b[2];
-
- b[0] += (b[2] ^ (b[1] | ~b[3])) + (i[0] + 0xf4292244 >>> 0); b[0] = b[0] << 6 | b[0] >>> 26; b[0] += b[1];
- b[3] += (b[1] ^ (b[0] | ~b[2])) + (i[7] + 0x432aff97 >>> 0); b[3] = b[3] << 10 | b[3] >>> 22; b[3] += b[0];
- b[2] += (b[0] ^ (b[3] | ~b[1])) + (i[14] + 0xab9423a7 >>> 0); b[2] = b[2] << 15 | b[2] >>> 17; b[2] += b[3];
- b[1] += (b[3] ^ (b[2] | ~b[0])) + (i[5] + 0xfc93a039 >>> 0); b[1] = b[1] << 21 | b[1] >>> 11; b[1] += b[2];
- b[0] += (b[2] ^ (b[1] | ~b[3])) + (i[12] + 0x655b59c3 >>> 0); b[0] = b[0] << 6 | b[0] >>> 26; b[0] += b[1];
- b[3] += (b[1] ^ (b[0] | ~b[2])) + (i[3] + 0x8f0ccc92 >>> 0); b[3] = b[3] << 10 | b[3] >>> 22; b[3] += b[0];
- b[2] += (b[0] ^ (b[3] | ~b[1])) + (i[10] + 0xffeff47d >>> 0); b[2] = b[2] << 15 | b[2] >>> 17; b[2] += b[3];
- b[1] += (b[3] ^ (b[2] | ~b[0])) + (i[1] + 0x85845dd1 >>> 0); b[1] = b[1] << 21 | b[1] >>> 11; b[1] += b[2];
- b[0] += (b[2] ^ (b[1] | ~b[3])) + (i[8] + 0x6fa87e4f >>> 0); b[0] = b[0] << 6 | b[0] >>> 26; b[0] += b[1];
- b[3] += (b[1] ^ (b[0] | ~b[2])) + (i[15] + 0xfe2ce6e0 >>> 0); b[3] = b[3] << 10 | b[3] >>> 22; b[3] += b[0];
- b[2] += (b[0] ^ (b[3] | ~b[1])) + (i[6] + 0xa3014314 >>> 0); b[2] = b[2] << 15 | b[2] >>> 17; b[2] += b[3];
- b[1] += (b[3] ^ (b[2] | ~b[0])) + (i[13] + 0x4e0811a1 >>> 0); b[1] = b[1] << 21 | b[1] >>> 11; b[1] += b[2];
- b[0] += (b[2] ^ (b[1] | ~b[3])) + (i[4] + 0xf7537e82 >>> 0); b[0] = b[0] << 6 | b[0] >>> 26; b[0] += b[1];
- b[3] += (b[1] ^ (b[0] | ~b[2])) + (i[11] + 0xbd3af235 >>> 0); b[3] = b[3] << 10 | b[3] >>> 22; b[3] += b[0];
- b[2] += (b[0] ^ (b[3] | ~b[1])) + (i[2] + 0x2ad7d2bb >>> 0); b[2] = b[2] << 15 | b[2] >>> 17; b[2] += b[3];
- b[1] += (b[3] ^ (b[2] | ~b[0])) + (i[9] + 0xeb86d391 >>> 0); b[1] = b[1] << 21 | b[1] >>> 11; b[1] += b[2];
-
- checksum_h[0] += b[0];
- checksum_h[1] += b[1];
- checksum_h[2] += b[2];
- checksum_h[3] += b[3];
- }
-
- return new Uint8Array(checksum_h.buffer);
-};
-
-
-var UTF8 = {
-
- encode: function(string) {
- var
- value = String(string)
- , inputlength = value.length
- , code
- , codehi
- , character
- , bytes = 0
- , buffer
- , ip = 0
- , op = 0
- , size
- , first;
-
- // First we need to perform a check to see the string is valid, and
- // compute the total length of the encoded data
-
- while (inputlength--) {
- code = value.charCodeAt(ip++);
-
- if (code >= 0xDC00 && code <= 0xDFFF) {
- throw new Error(
- "Invalid sequence in conversion input");
-
- } else if (code >= 0xD800 && code <= 0xDBFF) {
- if (inputlength < 1) {
- throw new Error(
- "Partial character sequence at end of input");
-
- } else {
- codehi = value.charCodeAt(ip++);
- if ((codehi < 0xDC00) || (codehi > 0xDFFF)) {
- throw new Error(
- "Invalid sequence in conversion input");
-
- } else {
- character = ((codehi) - 0xd800) * 0x400 +
- (code) - 0xdc00 + 0x10000;
- }
- inputlength--;
- }
- } else {
- character = code;
- }
- bytes += ((character) < 0x80 ? 1 :
- ((character) < 0x800 ? 2 :
- ((character) < 0x10000 ? 3 :
- ((character) < 0x200000 ? 4 :
- ((character) < 0x4000000 ? 5 : 6)))));
- }
-
- // Now we know the string is valid and we re-iterate.
-
- buffer = new Uint8Array(bytes);
- inputlength = value.length;
- ip = 0;
-
- while (inputlength--) {
- code = value.charCodeAt(ip++);
-
- if (code >= 0xD800 && code <= 0xDBFF) {
- codehi = value.charCodeAt(ip++);
- character = ((codehi) - 0xd800) * 0x400 +
- (code) - 0xdc00 + 0x10000;
- inputlength--;
- } else {
- character = code;
- }
-
- size = 0;
-
- if (character < 0x80) {
- first = 0;
- size = 1;
- } else if (character < 0x800) {
- first = 0xc0;
- size = 2;
- } else if (character < 0x10000) {
- first = 0xe0;
- size = 3;
- } else if (character < 0x200000) {
- first = 0xf0;
- size = 4;
- } else if (character < 0x4000000) {
- first = 0xf8;
- size = 5;
- } else {
- first = 0xfc;
- size = 6;
- }
-
- for (var i = op + size - 1; i > op; i--) {
- buffer[i] = (character & 0x3f) | 0x80;
- character >>= 6;
- }
- buffer[op] = character | first;
- op += size;
-
- }
-
- return buffer;
-
- },
-
- get_utf8_char: function(data, index) {
- var
- code = data[index]
- , size = 0
- , min_code = 0;
-
- if (code < 0x80) {
-
- } else if (code < 0xc0) {
- throw new Error("Invalid byte sequence in conversion input");
-
- } else if (code < 0xe0) {
- size = 2;
- code &= 0x1f;
- min_code = 1 << 7;
-
- } else if (code < 0xf0) {
- size = 3;
- code &= 0x0f;
- min_code = 1 << 11;
-
- } else if (code < 0xf8) {
- size = 4;
- code &= 0x07;
- min_code = 1 << 16;
-
- } else if (code < 0xfc) {
- size = 5;
- code &= 0x03;
- min_code = 1 << 21;
-
- } else if (code < 0xfe) {
- size = 6;
- code &= 0x01;
- min_code = 1 << 26;
-
- } else {
- throw new Error("Invalid byte sequence in conversion input");
- }
-
- for (i = 1; i < size; i++) {
- ch = data[index+i];
-
- if (ch === void 0) {
- throw new Error("Partial character sequence at end of input");
- }
-
- if ((ch & 0xc0) != 0x80) {
- throw new Error("Invalid byte sequence in conversion input");
- }
-
- code <<= 6;
- code |= (ch & 0x3f);
- }
-
- if (code < min_code) {
- throw new Error("Invalid byte sequence in conversion input");
- }
-
- return code;
- },
-
- decode: function(data) {
- throw new Error("Utf8.decode is not implemented");
- }
-
-};
-
-global.MD5 = MD5;
-global.UTF8 = UTF8;
-global.Base64 = Base64;
-
-}
-
-var Sol = function Sol(arg, absolute) {
- var num;
- if (arguments.length === 0) {
- num = (new Date().getTime() / 86400000);
- } else if (Object.prototype.toString.call(arg) === "[object Date]") {
- num = (arg.getTime() / 86400000);
- } else if (typeof arg === "number") {
- num = arg;
- } else if (typeof arg === "string") {
- return Sol.parseSol(arg);
- } else {
- throw new TypeError("Sol constructor expects Date, number, or string argument");
- }
- this.floating = num;
- this.absolute = typeof absolute != "undefined" ? absolute : true;
-};
-
-Sol.prototype.valueOf = function() { return this.floating; };
-Sol.prototype.toSolString = Sol.prototype.toString = function() {
- if (this.floating === Infinity) { return "∞ſ"; }
- if (this.floating === -Infinity) { return "-∞ſ"; }
-
- if (this.absolute) {
- var num = this.floating.toFixed(6), m = num.match(/e(\+|-)/);
- if (m) return m[1] === "+" ? "∞ſ" : "-∞ſ";
-
- var sep = num.split(".");
- var sol = sep[0].replace(/(\d)(?=(\d{3})+$)/g, "$1 ")+" ſ "+sep[1].substr(0,3)+" "+sep[1].substr(3,3);
- return sol;
- } else {
- var keys = [
- ["k", 1000000000],
- ["", 1000000],
- ["m", 1000],
- ["µ", 1]
- ];
- var builder = [];
- var num = this.floating*1000000;
- for (var i = 0, len = keys.length; i < len; i++) {
- var numspecific = 0;
- if (num >= keys[i][1]) {
- numspecific = num / keys[i][1] | 0;
- num -= numspecific * keys[i][1];
- }
- if (numspecific) {
- builder.push(numspecific + keys[i][0] + "ſ");
- }
- }
- if (!builder.length) builder.push("0ſ");
- return builder.join(" ");
- }
-};
-
-Sol.prototype.toHumanString = function() {
- var num = this.floating * 86400000;
-
- var keys = [
- ["year", 31536000000],
- ["month", 2678400000],
- ["week", 604800000],
- ["day", 86400000],
- ["hour", 3600000],
- ["minute", 60000],
- ["second", 1000],
- ["millisecond", 1]
- ];
-
- var builder = [];
- for (var i = 0, len = keys.length; i < len; i++) {
- var numspecific = 0;
- while (num >= keys[i][1]) {
- numspecific++;
- num -= keys[i][1];
- }
- if (numspecific) {
- builder.push(numspecific + " " + keys[i][0] +
- (numspecific === 1?"":"s"));
- }
- }
- if (!builder.length) builder.push("Zero.");
- return builder.join(", ");
-};
-
-Sol.parseHuman = function(text) {
- var t = 0, m;
- m = text.match(/([0-9.]+)\s*eternity/);
- if (m) {
- if (m[1] != 0) {
- this.floating = m[1]*Infinity;
- return;
- };
- }
- m = text.match(/([0-9.]+)\s*y/); if (m) { t += m[1]*31536000000; }
- m = text.match(/([0-9.]+)\s*mo/); if (m) { t += m[1]*2678400000; }
- m = text.match(/([0-9.]+)\s*w/); if (m) { t += m[1]*604800000; }
- m = text.match(/([0-9.]+)\s*d/); if (m) { t += m[1]*86400000; }
- m = text.match(/([0-9.]+)\s*h/); if (m) { t += m[1]*3600000; }
- m = text.match(/([0-9.]+)\s*m(?:$|[^os])/); if (m) { t += m[1]*60000; }
- m = text.match(/([0-9.]+)\s*s/); if (m) { t += m[1]*1000; }
- m = text.match(/([0-9.]+)\s*ms/); if (m) { t += m[1]*1; }
-
- return new Sol(t / 86400000, false);
-};
-
-Sol.parseSol = function(text) {
-
- var units = {
- kS: 1000000000,
- hS: 100000000,
- daS: 10000000,
- S: 1000000,
- dS: 100000,
- cS: 10000,
- mS: 1000,
- µS: 1
- };
- var t = 0;
-
- text = text.replace(/[ ,ſ]/g, function(ch) {
- return ch === "ſ" ? "S" : "";
- });
- matches = text.match(/([\d.]+)\s*(k|h|da|d|c|m|µ|)\s*S/gi);
- if (matches) {
- for (var i = 0, len = matches.length; i < len; i++) {
- var modifier = matches[i];
- var value = parseInt(modifier, 10);
- var unit = modifier.match(/(k|h|da|d|m|µ|)S/)[0];
- t += value * units[unit];
- }
- }
- return new Sol(t/1000000, false);
-};
-global.Sol = Sol;
-exports.Sol = Sol;
-
View
17 oftnbot.js
@@ -64,6 +64,17 @@ util.inherits(ΩF_0Bot, Bot);
this.register_command("gh", this.gh);
this.register_command("projects", this.projects);
+ this.register_listener(/^([a-z0-9]+[:,])?\s*((lol|oh|wtf|hey|no|omg|um|but|actually|idk|also|and|just|then|what|wat|woah|whoah|ok|okay)\s*)*\bwait\b/i, function(context) {
+ if (context.sender.name === "sephr") {
+ context.client.raw ("PRIVMSG ChanServ :OP #oftn");
+ setTimeout (function() {
+ context.client.raw ("KICK #oftn sephr :You're not allowed to tell people to wait.");
+ context.client.raw ("MODE #oftn +b *!*@unaffiliated/sephr :");
+ context.client.raw ("PRIVMSG ChanServ :DEOP #oftn");
+ }, 2 * 1000);
+ }
+ });
+
this.password = "I solemnly swear that I am up to no evil";
this.register_command("access", function(context, text) {
@@ -180,11 +191,11 @@ util.inherits(ΩF_0Bot, Bot);
var chunks = [], channel;
// Get the channel to send messages in from the url
- channel = url.parse(request.url).pathname.replace(/[^A-Z0-9\.]/ig, '').replace(/\./g, '#');
+ channel = decodeURIComponent(url.parse(request.url).pathname.slice(1));
if (!channel) {
- channel = "oftn";
+ channel = "#oftn";
}
- channel = "#"+channel;
+ console.log("Received GitHub update for %s", channel);
request.setEncoding("utf8");
request.on("data", function(chunk) {
View
2 shared.js
@@ -68,7 +68,7 @@ var Shared = module.exports = {
clearTimeout (person.js.timeout);
}
- this.sandbox.run(engine, 3000, code, function(result) {
+ this.sandbox.run(engine, 4000, code, function(result) {
var reply;
try {

0 comments on commit 4366288

Please sign in to comment.