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
#!/usr/bin/env python3 | |
from __future__ import print_function | |
from random import SystemRandom | |
from os.path import join, dirname | |
sysrandom = SystemRandom() |
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
;;; https://leosstemhacks.wordpress.com/2018/03/27/np-complete-3rd-grade-math-problems/ | |
;;; https://news.ycombinator.com/item?id=28343073 | |
;;; | |
;;; I frame this as a satisfiability problem and tackle it with backtracking | |
;;; and an optimizing heuristic | |
;;; | |
;;; The heuristic is this, we sort the items from lowest value to greatest | |
;;; and only try to add the next lowest item available in our search | |
;;; if that item puts the total over, then we know all remaining items | |
;;; which are of greater value will do the same |
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
}, u.default.createElement(s.Camera, { | |
onBarCodeScanned: R ? function(t) { | |
var l, o, u, c, s, p, y; | |
return n.default.async(function(v) { | |
for (;;) switch (v.prev = v.next) { | |
case 0: | |
return l = t.type, o = t.data, v.next = 3, n.default.awrap(f.getNetworkStateAsync()); | |
case 3: | |
if (!1 !== (u = v.sent).isConnected && !1 !== u.isInternetReachable) { | |
v.next = 8; |
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
abandon | |
ability | |
able | |
about | |
above | |
absent | |
absorb | |
abstract | |
absurd | |
abuse |
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
Elected by acclamation | |
Michael Kozakewich | |
Kyle Martin | |
Edwin Amsler | |
Thor Robinson | |
Pietra Shirley |
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
<p> | |
<a href="https://markjenkins.ca">Return to markjenkins.ca</a> | |
</p> | |
<p> | |
This contact form submits to my | |
<a href="mailto:mark@markjenkins.ca">mark@markjenkins.ca</a> email address. | |
</p> |
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
Voter code yS2MuD4+iPrmZOoSIY76qLCMQWS/wQxnql8MmpN9AUY= votes for Pirates | |
non interactively | |
echo -e "yS2MuD4+iPrmZOoSIY76qLCMQWS/wQxnql8MmpN9AUY=\nPirates" | python3 hmac_vote.py | |
interactively | |
python3 hmac_vote.py | |
What's your code? > yS2MuD4+iPrmZOoSIY76qLCMQWS/wQxnql8MmpN9AUY= | |
Your code is: | |
yS2MuD4+iPrmZOoSIY76qLCMQWS/wQxnql8MmpN9AUY= |
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
from functools import reduce | |
def map( func, iterable): | |
def f(a, b): | |
return a + [func(b)] | |
return reduce( f, iterable, [] ) |
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
#!/usr/bin/env python3 | |
# Solution to http://adventofcode.com/2016/day/4 part 1 | |
# Mark Jenkins <mark@markjenkins.ca> | |
from sys import stdin | |
from collections import Counter | |
from itertools import islice | |
CHECKSUM_SIZE = 5 |
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
#!/usr/bin/env python3 | |
# functional solution to http://adventofcode.com/2016/day/3 part 1 | |
# Mark Jenkins <mark@markjenkins.ca> | |
from sys import stdin | |
def possible_triangle(args): | |
assert(len(args)==3) | |
sum_args = sum(args) |