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
# Array sum helper function. | |
sum = (array) -> | |
array.reduce (x, y) -> x + y | |
md5 = do -> | |
# Per-round shift amounts. | |
s = [738695, 669989, 770404, 703814] | |
s = (s[i >> 4] >> i % 4 * 5 & 31 for i in [0..63]) | |
# Constants cache generated by sine. |
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
str2hex = do -> | |
hex = ['0', '1', '2', '3', '4', '5', '6', '7', | |
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'] | |
hex = (hex[x >> 4] + hex[x & 15] for x in [0..255]) | |
(str) -> | |
(hex[c.charCodeAt()] for c in str).join '' | |
hex2str = (hex) -> | |
(String.fromCharCode parseInt hex[i...i + 2], 16 for i in [0...hex.length] by 2).join '' |
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
crc32 = do -> | |
table = | |
for n in [0..255] | |
for [0..7] | |
if n & 1 | |
n = 0xEDB88320 ^ n >>> 1 | |
else | |
n >>>= 1 | |
n | |
(str, crc = -1) -> |
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
iter = (x) -> | |
yield from x |
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
next = (x) -> | |
x.next().value |
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
""" | |
Rationale: Some websites make it difficult to scrape from by obfuscating their otherwise JSON data with | |
things such as unquoted object keys, concatenated strings, comments, etc. which are all valid JavaScript | |
constructs but invalid JSON. This usually forces would-be web scraper developers to emulate an entire | |
browser just to mine the data, which apparently is a fairly successful deterrent. This script parses the | |
JavaScript AST without executing any potentially malicious JavaScript DRM code, and correctly parses a | |
number of valid JavaScript constructs into a Python dictionary. | |
It also provides methods to quickly download a web page and search for a global variable using pyquery. | |
""" |
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. Label Computer | |
-- 2. Save file as "/startup" | |
while true do | |
for slot=1,16 do | |
if turtle.getItemCount(slot) > 0 then | |
turtle.select(slot) | |
for j=slot+1,16 do | |
if turtle.compareTo(j) then | |
turtle.select(j) |
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
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4Cf/FkBdABiNghz+hLr94AK3xzwehblXPYMYwErnPWg+OjV176yNUF7Bsoo/sliR3d8e1PmlTedMJpBSdERua6/zkiYn/6/HYol1fyHocRQ/eQhm8W22giOO0x/oOmY1TjpJJyIGcCdcb5BNnjRzSr4I+VUtYjpAFAl4dp/rVo7EA99nQx8lMC3D3FguDmQp3Ki2yD4Z6YJwHDmzX4r0C1ozUSkjQ/yv/SxUdhb8XiJnGhrRzDm2ykNvwxDJe8L4xA5uSil6DJICf02eXtXZgXK3AFPAjsuJZ803nqntJ7wM/LpJ3WA/qgca8ZkOCitNXNMzsjjB1y7yPUUbzhhlSfS+T0dqFGRtWv52DhF1Y2fkg+qRkfSHLXRIy3puL58b+Aon2//l6DrB+n/Axd1LnpFE0c3tR9MAgME0mgKjO6rG1NTf4FFuUWjquKvF1qgtySnepNjPUZpGqiZZD4CvnP0lOjktWglk1uejb44EKAiw3oYtMSBr4QN/aedOLfVc7qHQUwBEee2ai+DhHOQyeHnxtLHdNYLHxlAPMQCQJE+Oo3PxRt7BGn9ZEXM7BliFq76RZ/qcJDGVwgbVVjtLFvpNbdA05/kC5ja3fJnNjfrx1QNfNwglhFJH+s6SvoIRcWpr2EzTN5E8HwxVOGqLA4xxaVCFWNCmLl+Pb2HBOWZecb++Xqz8WvCcMD5gKlRb8VTWJJcSLR1Sg82jdCm6mwmnm863z/a8d3/qYhvSwf/tuWhqj+YotTS3hvJn6q+S/410mqm1QX9druFhOKiM9TnLb0DnYyN2RsLyz9dkkxGc822fsle2p2BLhq9+8ZiVPrFqKgu+9uZBdHJgBZcrkeTYsuffQtQ9fd5bz0cVB2cTZ0Rm7gfx72Byd0oj+6Dc175zYiNKkC616RX/EAGeO+tLJHASQ2naRS3kp7+dPVUkkQ0vd47vC3OUzMlV+y2ZK9V2ISUYEEi4d70DkXbvDpP6ZGvt1On9 |
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(a) { | |
var j = [1056971584,1092420379, 222248973,1128348931, 239223324, 473841219, | |
507790366, 924989, 457179966,1060977933,1092295748, 218317597, | |
1075723843,1141775679, 239223296, 505151553], | |
k = [1953896747, 688289143,2020897649,1982400117, 707557120,1897474930, | |
746061866, 443773466, 2848041,2003989273,1920337524, 721820017, | |
443754872, 746027052, 704673306,1903522858], | |
n = [ 206766165,1442849110, 576215071,1411535372,1359237899, 542266657, | |
1461722967, 72616785,1397826060, 525555200, 186799190,1477115989, | |
1461670228, 69279832,1381436498, 553932064], |