Skip to content

Instantly share code, notes, and snippets.

View daira's full-sized avatar

Daira-Emma Hopwood daira

View GitHub Profile
SELECT alltxs.block_timestamp_month, fulltxs.fully_shielded_count, 100*fulltxs.fully_shielded_count/alltxs.count AS fully_shielded_percent FROM
(SELECT
block_timestamp_month, count(distinct `hash`) AS fully_shielded_count
FROM
`bigquery-public-data.crypto_zcash.transactions` AS zec_txs
WHERE
NOT EXISTS (SELECT 1 FROM UNNEST(zec_txs.inputs) WHERE NOT type = 'shielded')
AND NOT EXISTS (SELECT 1 FROM UNNEST(zec_txs.outputs) WHERE NOT type = 'shielded')
GROUP BY block_timestamp_month) fulltxs
INNER JOIN
# https://eprint.iacr.org/2012/254
def random(K):
ctr = 0
while True:
yield AES(K, ctr)
ctr += 1
def PRP(K, x):
return (x, 0, N, 0, random(K))
@daira
daira / gist:3300082
Created August 9, 2012 00:56
ExpirationPolicy
class ExpirationPolicy(object):
def __init__(self, enabled=False, mode="age", override_lease_duration=None,
cutoff_date=None, sharetypes=("mutable", "immutable")):
precondition(isinstance(enabled, bool), enabled=enabled)
precondition(mode in ("age", "cutoff-date"), mode=mode)
precondition(isinstance(override_lease_duration, (int, NoneType)),
override_lease_duration=override_lease_duration)
precondition(isinstance(cutoff_date, int) or (mode != "cutoff-date" and cutoff_date is None),
cutoff_date=cutoff_date)
precondition(isinstance(sharetypes, tuple), sharetypes=sharetypes)
@daira
daira / gist:3290388
Created August 7, 2012 23:08
excerpt from #leastauthorityenterprises on freenode
(18:37:09) amiller: zooko, i'd like to chat about lae sometime soon
(18:39:45) zooko: amiller: Hi! Oh, I'd love that. What mode of chat do you prefer?
(18:39:52) amiller: irc!
(18:39:54) zooko: When's the next time you're coming to visit Boulder? :-)
(18:40:00) amiller: sometime!
(18:40:02) zooko: Okay, anytime!
(18:40:05) amiller: how bout now
(18:40:06) zooko: I mean, okay anytime about IRC chat.
(18:40:09) zooko: Okay.
(18:40:38) amiller: i figured out / remembered how to use flogtool again