Skip to content

Instantly share code, notes, and snippets.

Bryan Bishop kanzure

Block or report user

Report or block kanzure

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kanzure
kanzure / blstoy.cpp
Created Apr 3, 2017
Short attempt at verifying an aggregate signature using BLS and a single pubkey
View blstoy.cpp
#include <iostream>
#include "bls.h"
int main() {
std::cout << "Signature aggregation toy attempt\n";
// create instance of Bls class
bls::Bls my_bls = bls::Bls();
@kanzure
kanzure / find-most-recent-common-block.py
Last active Aug 23, 2016
Find the most recent common block between two different, partially synchronized blockchain data stores. Attempt to do so without calling the _batch RPC call for 500,000 getblockhash requests. See https://botbot.me/freenode/bitcoin-core-dev/2016-04-28/?msg=65077020&page=3
View find-most-recent-common-block.py
"""
Toy demo for finding the most recent common block between a database and a
bitcoind instance. The goal is to correctly handle reorgs and long periods of
downtime if any. The previous implementation used getblockhashes and the _batch
RPC call to get 300,000 blockhashes at a time. Unfortunately bitcoind is not
really made to handle requests of that size. Instead, here is a more optimized
implementation that should take less time and a minimal number of RPC requests.
The output of this is fed into a planner which generates a plan for processing
the blocks between a current blockhash and the last most recent common block.
"""
@kanzure
kanzure / unexpected-docker-build-cache-miss.md
Created Feb 13, 2016
Unexpected docker build cache miss after successful --no-cache
View unexpected-docker-build-cache-miss.md
git checkout master # setup Dockerfile
docker-compose build # uses cache (expected)
git checkout HEAD^1 # removes some line from Dockerfile
docker-compose build # uses cache (expected)
git checkout master # adds back same line to Dockerfile
docker-compose build --no-cache # does not use input from the cache (expected)
git checkout HEAD^1 # removes same line from Dockerfile
docker-compose build # has unexpected cache miss
@kanzure
kanzure / textmass.py
Created Nov 21, 2015
hplusroadmap irc log visualization
View textmass.py
"""
Render an image of the "text mass" per minute per day of logs. Horizontal
minutes against vertical days. The color of each pixel represents the relative
text mass for that time slice (that minute).
http://gnusha.org/logs/graphs/300-days-anycolor-heatmap-cropped-sorted.png
1440 minutes/day
2555 days
1440 * 2555
@kanzure
kanzure / replication-steps.txt
Created Jul 17, 2015
Replication of RPC thread hanging using bitcoind v0.10.2.0-g16f4560
View replication-steps.txt
# start bitcoind in regtest mode
# ... set the following parameters:
# -rpcthreads=1 -rpctimeout=5
# The behavior can be seen more readily with rpcthreads=1.
bitcoind -regtest -rcpthreads=1 -rpctimeout=5 -debug=1 -logtimestamps=1 -printtoconsole=1 -server=1 -listen=1 -maxconnections=500 -txindex=1
# NOTE: Also, alertnotify and blocknotify scripts are being executed, although
# they don't seem to be necessary to trigger this behavior?
# using python-bitcoinlib in python3.4, although python-bitcoinrpc or even bitcoin-cli might work for this
@kanzure
kanzure / README.md
Created Apr 13, 2015
Prototype: stochastic cooperation in the One-Shot Prisoner's Dilemma in probabilistic programming
View README.md

(The following is from an email that was received on the decision-theory-workshop@googlegroups.com mailing list...)

Well, I finally managed to sit down and code the entire prototype. This has been refined a couple times and tested via the Church play-space (https://probmods.org/play-space.html). The parameters and set-up can probably use some tweaking to make the cooperation more robust (ie: more probable/numerous as a fraction of the histogram used for testing), but oh well.

The paper follows the Goodman & Tenenbaum approach of "commonsense reasoning as conditional simulation (in probabilistic generative models)". Each agent simulates:

  • The other agent simulating it,
  • Simulating the other agent playing naively.

So the recursion levels are:

@kanzure
kanzure / zerocounter.py
Created Mar 19, 2015
Get better at visually distinguishing between varying length sequences of zeros.
View zerocounter.py
"""
Small program to help develop the ability to count the number of zeros in a
number very quickly.
An upgrade to this would be the following: Randomly generate a number with
multiple long repeating sequences of integers. Then ask the user for the length
of the longest repeating sequence within the number.
"""
import random
@kanzure
kanzure / wei-dai-snooper.py
Created Nov 24, 2014
just snooping around the blockchain, don't mind me
View wei-dai-snooper.py
from bitcoin.core import (
lx,
b2lx,
CTransaction,
)
import bitcoin.rpc
proxy = bitcoin.rpc.Proxy()
@kanzure
kanzure / strace.log.txt
Created Nov 3, 2014
zotero translation server log
View strace.log.txt
[pid 2710] munmap(0xf76d9000, 4096) = 0
[pid 2710] gettimeofday({1415052462, 101172}, NULL) = 0
[pid 2710] write(1, "zotero(3)(+0000000): HTTP server"..., 54zotero(3)(+0000000): HTTP server listening on *:1969
) = 54
[pid 2710] gettimeofday({1415052462, 101468}, NULL) = 0
[pid 2710] gettimeofday({1415052462, 101526}, NULL) = 0
[pid 2710] gettimeofday({1415052462, 101615}, NULL) = 0
[pid 2710] gettimeofday({1415052462, 101671}, NULL) = 0
[pid 2710] gettimeofday({1415052462, 101738}, NULL) = 0
@kanzure
kanzure / log.txt
Created Nov 3, 2014
new zotero translators since last update
View log.txt
create mode 100644 Bundesgesetzblatt.js
create mode 100644 CCfr (BnF).js
create mode 100644 CSV.js
delete mode 100644 CanLII (English).js
create mode 100644 CanLII.js
create mode 100644 DAI-Zenon.js
create mode 100644 Eastview.js
create mode 100644 Hispanic-American Periodical Index (Beta).js
create mode 100644 National Library of Belarus.js
create mode 100644 OhioLINK.js
You can’t perform that action at this time.