Skip to content

Instantly share code, notes, and snippets.

View warner's full-sized avatar

Brian Warner warner

  • San Francisco, CA
View GitHub Profile
#! /usr/bin/python
# connect to a BitCoin node and interpret the data it emits. first steps
# towards building a pure-python bitcoin client. Uses code and ideas from
# http://github.com/gavinandresen/bitcointools .
import struct, random, time, base64, socket, sys
from twisted.internet import reactor, protocol
from hashlib import sha256
from StringIO import StringIO
@warner
warner / gist:768580
Created January 6, 2011 21:04
Accounting notes
* Ostrom Accounting
** apply Elinor Ostrom's eight "design principles" (of stable local
common pool resource [CPR] management) from
http://en.wikipedia.org/wiki/Elinor_Ostrom
- 1. Clearly defined boundaries (effective exclusion of external
unentitled parties);
- 2. Rules regarding the appropriation and provision of common
resources are adapted to local conditions;
- 3. Collective-choice arrangements allow most resource appropriators
to participate in the decision-making process;
@warner
warner / README.md
Created January 26, 2011 22:31
bug description

These two screenshots show what you get when you hit "b" (to invoke a branch command of some sort). The last line of the magit-key window is obscured, because the help text is too long, causing the echo area to grow (to two lines instead of one). The second screenshot shows what happens after you hit SPACE or other non-action character, causing the echo area to return to normal, revealing the missing commands in the magit-key window.

@warner
warner / initialize.py
Created October 15, 2011 01:08
potential replacement for initializer()
from templates import EMPTY_FOLDER
def create(output_root, template_path, content, out=sys.stdout):
# content may be EMPTY_FOLDER, which means just make the directories
path_components = template_path.split("/")
parents = path_components[:-1]
if parents:
output_dir = os.path.join(output_root, *parents)
if not os.path.exists(output_dir):
@warner
warner / make-html.py
Created May 13, 2012 20:47
turn a firefox sessionstore.js into an HTML page
#!/usr/bin/python
import os, sys, json, time
from twisted.python import usage
class Usage(usage.Options):
optParameters = [
("sessionfile", "s", None, "sessionstore.js to read, uses new-b9 profile by default"),
("outfile", "o", "-", "write tabs.html to here"),
]
def postOptions(self):
@warner
warner / test-chain.js
Created June 22, 2012 23:45
cert-chain processing
const secondaryPower = { all: true,
domains: "all",
expiration: Number.MAX_VALUE };
function makePrimaryPower(domain) { // also used for IdP Proxies
return { all: false, domains: [domain], expiration: Number.MAX_VALUE};
}
function evalChain(initialPower, certParamsArray) {
// Returns principal or throws error
@warner
warner / index.md
Created June 27, 2012 00:28
blog post draft

Persona RP Name/Logo

Before: no name or logo

With siteName: with siteName but no logo

With siteLogo: with siteLogo but no name

@warner
warner / README.txt
Created July 20, 2012 02:26
screenshots
this repo holds screenshots for bug reports
#include <botan/botan.h>
#include <botan/pbkdf2.h>
#include <botan/hmac.h>
#include <botan/sha2_32.h>
#include <iostream>
#include <memory>
using namespace Botan;
std::string password_hash(const std::string& pass,
@warner
warner / README.md
Last active December 11, 2015 16:48
test for gombot-crypto-jetpack
We couldn’t find that file to show.