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
#include <cstdio> | |
using namespace std; | |
const int MAX_N = 15; | |
int A[MAX_N]; | |
int n, k; | |
int main() { |
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
import pprint, math | |
pp = pprint.PrettyPrinter() | |
class Piece: | |
def __init__(self, color): | |
self.color = color | |
def __repr__(self): | |
color_str_from_bool = { |
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
dionyziz@puppy ~ % ping 1.1.1.1 | |
PING 1.1.1.1 (1.1.1.1): 56 data bytes | |
64 bytes from 1.1.1.1: icmp_seq=0 ttl=59 time=864.718 ms | |
64 bytes from 1.1.1.1: icmp_seq=1 ttl=59 time=237.562 ms | |
64 bytes from 1.1.1.1: icmp_seq=2 ttl=59 time=36.199 ms | |
64 bytes from 1.1.1.1: icmp_seq=3 ttl=59 time=226.168 ms | |
64 bytes from 1.1.1.1: icmp_seq=4 ttl=59 time=18.690 ms | |
64 bytes from 1.1.1.1: icmp_seq=5 ttl=59 time=80.011 ms | |
Request timeout for icmp_seq 6 | |
64 bytes from 1.1.1.1: icmp_seq=7 ttl=59 time=47.027 ms |
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
import pprint | |
pp = pprint.PrettyPrinter() | |
class Piece: | |
def __init__(self, color): | |
self.color = color | |
def __repr__(self): | |
color_str_from_bool = { |
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
const y = (t) => { | |
const b = ({b, t}) => { | |
return (n) => { | |
const a = () => { | |
return {b, t} | |
} | |
return t(b(a()))(n) | |
} | |
} |
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
dionyziz@puppy ~/workspace/recursion-thm (master*) % cat examples/factorial.js | |
return (n) => { | |
if (n == 0) { | |
return 1 | |
} | |
return n * eval(SELF)(n - 1) | |
} | |
dionyziz@puppy ~/workspace/recursion-thm (master*) % node compiler.js < examples/factorial.js > examples/factorial-compiled.js | |
dionyziz@puppy ~/workspace/recursion-thm (master*) % cat examples/factorial-compiled.js | |
(SELF => {return (n) => { |
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
(SELF => {console.log(SELF) | |
})((({BStr, TStr}) => { | |
const AStr = ((BStr, TStr) => { | |
const escape = (str) => { | |
return str.replace( | |
/\\/g, '\\\\' | |
).replace( | |
/`/g, '\\\`' | |
).replace( | |
/\$/g, '\\$' |
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
// v1 | |
(w) => (function (w) { return "(w) => (" + w + ")" + "((function (w) { return \"" + w.replace(/\\/g, '\\\\').replace(/"/g, '\\\"') + "\" })(w))" })((function (w) { return "function (w) { return \"(w) => (\" + w + \")\" + \"((function (w) { return \\\"\" + w.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\\\"') + \"\\\" })(w))\" }" })(w)) | |
// v2 | |
(w) => ((w) => "(w) => (" + w + ")" + "(((w) => \"" + w.replace(/\\/g, '\\\\').replace(/"/g, '\\\"') + "\")(w))")(((w) => "(w) => \"(w) => (\" + w + \")\" + \"(((w) => \\\"\" + w.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\\\"') + \"\\\")(w))\"")(w)) |
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
class Bank { | |
constructor() { | |
this.attacker_balance = 1; | |
} | |
withdraw() { | |
if (this.attacker_balance == 1) { | |
console.log('Sending ' + this.attacker_balance + ' ETH to attacker'); | |
send_money_to_attacker(this.attacker_balance); | |
} |
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
import operator | |
from functools import partial, reduce | |
def flatten(node): | |
if not node: | |
return [] | |
return flatten(node.left) + [node.val] + flatten(node.right) | |
def rangeSumBST(root, L, R): | |
return reduce(operator.add, |