Skip to content

Instantly share code, notes, and snippets.

@markjenkins
markjenkins / Barcode handling.js
Last active Jul 10, 2021 — forked from alexwebr/Barcode handling.js
Code snippet from MB Vaccine App
View Barcode handling.js
}, 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;
@markjenkins
markjenkins / bip39_english.txt
Created Apr 17, 2021
Create an Electrum segwit (0x100) seed from a standard seed (0x01) using BIP39 english list
View bip39_english.txt
abandon
ability
able
about
above
absent
absorb
abstract
absurd
abuse
View 2021-02-23_boardcandidates.txt
Elected by acclamation
Michael Kozakewich
Kyle Martin
Edwin Amsler
Thor Robinson
Pietra Shirley
View contact.html
<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>
@markjenkins
markjenkins / example_ballots.txt
Last active Aug 5, 2020
Election of a single candidate by HMAC
View example_ballots.txt
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=
View map_using_reduce.py
from functools import reduce
def map( func, iterable):
def f(a, b):
return a + [func(b)]
return reduce( f, iterable, [] )
View d4p1.py
#!/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
View d3p1.py
#!/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)
@markjenkins
markjenkins / d2p1.py
Created Dec 8, 2016
Solution to http://adventofcode.com/2016/day/2 using reduce and accumulate
View d2p1.py
#!/usr/bin/env python3
# Solution to http://adventofcode.com/2016/day/2 part 1
# using reduce and accumulate for awesome functional programing style points
# Mark Jenkins <mark@markjenkins.ca>
from sys import stdin
from functools import reduce
from itertools import chain, accumulate, islice
@markjenkins
markjenkins / d1p2.py
Last active Dec 7, 2016
solution to https://adventofcode.com/2016/day/1 part 2, uses reduce(), nearly functional
View d1p2.py
#!/usr/bin/env python3
# solution to https://adventofcode.com/2016/day/1 part 2
# in a functional style with python 3.3+ enhanced accumulate() and dropwhile()
# Mark Jenkins <mark@markjenkins.ca>
from itertools import accumulate, dropwhile, chain
MOVEMENTS = ((0,1), (1,0), (0,-1), (-1,0))
DIRECTION_CHANGES = {"R": 1, "L": -1}