Skip to content

Instantly share code, notes, and snippets.

View amiller's full-sized avatar

Andrew Miller amiller

View GitHub Profile
function g0() { return 0; }
function g1(a1) {
return a1;
}
function g2(a1,a2) {
return a1 + a2;
}
function g3(a1,a2,a3) {
return a1 + a2 + a3;
}
<script id="2d-vertex-shader" type="x-shader/x-vertex">
attribute vec2 a_position;
attribute vec2 a_texCoord;
uniform vec2 u_resolution;
uniform mat3 u_h;
varying vec2 v_texCoord;
void main() {
gl.begin(gl.GL_TRIANGLES);
gl.vertex3f(-1.0, -0.5, -4.0);
gl.vertex3f( 1.0, -0.5, -4.0);
gl.vertex3f( 0.0, 0.5, -4.0);
gl.end();
@amiller
amiller / a js library of sorts
Last active December 28, 2015 06:58
a js library of sorts / an adullam poem / by amiller and dot
you can rent an ec2 with an nvidia gpu for the samsun galaxy r
if a few asic farms compete with each other, then the marginal profit of asic farms must get pretty close to a working understanding of linux
i'll give 10 bitcoins to the winner
i just gave the winner a lego trophy
also every generation thinks "no really, the next generation of lego building instructions in 3d augmented reality!)
on someone elses pdf generation code
what pdf reader where you using?
ah so python has a reader for it
Hi Zooko, Albert, I took this opportunity to collect a bunch of my
thoughts from today and the past few weeks below. Apologies for the
ramble!
Despite the overhyped headline, this paper is important. It's part of
a (long past due) movement towards modeling "rational participation"
in Bitcoin. We are (surprisingly?) in a blind spot here as far as
theoretical foundations go (the 30+ years of research in distributed
systems, game theory, etc., have not looked at anything resembling
Bitcoin). We do not yet have a sound way to argue that "Bitcoin (or X
"""
gmaxwell's proof-of-storage
https://bitcointalk.org/index.php?topic=310323.0
"""
import random
from bisect import bisect_left
H = lambda v: (hash(("1",v)), hash(("2",v)))
def setup(k, seed):
@amiller
amiller / gist:6923910
Created October 10, 2013 19:17
atomic bitcoin transaction
This is an explanation of TierNolan's atomic cross transaction technique. It's similar to one by luxgladius, except this protocol avoids a race condition by using asymmetry - only Alice has a secret, and the timeout on one chain is much longer than the other. https://bitcointalk.org/index.php?topic=193281.msg2224949#msg2224949
Alice has 1btc (Bitcoin) and Bob has 1atc (Altcoin). They would like to conduct an atomic exchange, so that after a finite time, either Alice has 1atc and Bob has 1btc, or the transaction was aborted and their positions are both unchanged. We assume that both the Bitcoin and Altcoin chains are loosely synchronized to eachother, such that neither chain gets more than 12 hours skewed from the other.
Phase 1: Alice bails in
Alice draws a random secret x. Alice constructs TX1 to bail in a bitcoin. TX1 has a single txout with 1 btc, containing the following scriptPubkey:
OP_IF
// Refund for A
2 <pubkeyA> <pubkeyB> 2 OP_CHECKMULTISIGVERIFY
function mult_matrix(m1, m2) {
var m = [];
_.each(_.range(4), function (i) {
_.each(_.range(4), function (j) {
var x = 0;
_.each(_.range(4), function (k) {
x += m1[i * 4 + k] * m[k * 4 + j];
});
m[i * 4 + j]; = x;
});
2013-07-28 23:01:47
Full thread dump OpenJDK Server VM (20.0-b12 mixed mode):
"Attach Listener" daemon prio=10 tid=0x09cdd800 nid=0x245a waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"ModalContext" prio=10 tid=0x82131800 nid=0x2003 in Object.wait() [0x80cbe000]
@amiller
amiller / gist:5200006
Created March 19, 2013 20:49
Levy language (Call by push value)
open import Data.Bool
open import Data.Empty
open import Data.Maybe
open import Data.Nat
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Data.Fin
open import Data.List
open import Data.Unit
open import Data.Sum hiding (map)