Skip to content

Instantly share code, notes, and snippets.

@kanzure
kanzure / replication-steps.txt
Created July 17, 2015 19:03
Replication of RPC thread hanging using bitcoind v0.10.2.0-g16f4560
# 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 April 13, 2015 18:13
Prototype: stochastic cooperation in the One-Shot Prisoner's Dilemma in probabilistic programming

(The following is from an email that was received on the [email protected] 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 March 19, 2015 13:56
Get better at visually distinguishing between varying length sequences of zeros.
"""
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 November 24, 2014 01:17
just snooping around the blockchain, don't mind me
from bitcoin.core import (
lx,
b2lx,
CTransaction,
)
import bitcoin.rpc
proxy = bitcoin.rpc.Proxy()
@kanzure
kanzure / strace.log.txt
Created November 3, 2014 22:10
zotero translation server log
[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 November 3, 2014 22:03
new zotero translators since last update
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
@kanzure
kanzure / gumroadserver.py
Last active October 25, 2020 11:56
gumroad oauth debugger
"""
Simple HTTP server to authenticate with gumroad. This is useful for getting
a permanent auth token even if your application isn't a web app. Just use the
auth token when making requests in the future.
Start the process by visiting:
https://gumroad.com/oauth/authorize?client_id=CLIENT_ID&redirect_uri=http://YOURSERVER:7980/callback&scope=edit_products
"""
@kanzure
kanzure / ezproxyportal.py
Created August 24, 2014 19:39
http server to fetch content through ezproxy servers
from flask import (
Flask,
request,
)
app = Flask(__name__)
@app.route("/plsget")
def plsget():
data = request.get_json(force=True)
@kanzure
kanzure / log
Created August 15, 2014 23:20
bitcoind rpc port response
root@d7dcfd34bd4a:~# telnet 172.17.1.250 8332
Trying 172.17.1.250...
Connected to 172.17.1.250.
Escape character is '^]'.
HTTP/1.1 403 Forbidden
Date: Fri, 15 Aug 2014 23:19:05 +0000
Connection: close
Content-Length: 0
Content-Type: application/json
Server: bitcoin-json-rpc/v0.9.2.1-g354c0f3-beta
@kanzure
kanzure / haproxy.log
Created August 8, 2014 06:26
haproxy log madness
00000219:httpstuff.accept(0005)=0438 from [172.17.0.155:55870]
00000219:httpstuff.clireq[0438:ffffffff]: GET / HTTP/1.1
00000219:httpstuff.clihdr[0438:ffffffff]: User-Agent: curl/7.35.0
00000219:httpstuff.clihdr[0438:ffffffff]: Host: localhost:9304
00000219:httpstuff.clihdr[0438:ffffffff]: Accept: */*
0000021a:httpstuff.accept(0005)=043a from [172.17.0.155:55871]
00000219:httpstuff.clireq[043a:ffffffff]: GET / HTTP/1.1
00000219:httpstuff.clihdr[043a:ffffffff]: User-Agent: curl/7.35.0
00000219:httpstuff.clihdr[043a:ffffffff]: Host: localhost:9304
00000219:httpstuff.clihdr[043a:ffffffff]: Accept: */*