Skip to content

Instantly share code, notes, and snippets.

View amiller's full-sized avatar

Andrew Miller amiller

View GitHub Profile
@amiller
amiller / glass.html
Created March 25, 2014 17:52 — forked from rajeshbiib/glass.html
[wearscript] AR Warp with circles
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="offscreen" width="640" height="360" style="display:hidden"></canvas>
<script>
function drawCircle(x, y,tag) {
var width = 640;
var height = 360;
var c = document.getElementById("offscreen");
var ctx = c.getContext("2d");
ctx.fillStyle = 'black'
@amiller
amiller / glass.html
Created March 25, 2014 15:52
[wearscript] AR tag detection
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="offscreen" width="640" height="360" style="display:hidden"></canvas>
<script>
function drawCircle(x, y) {
var width = 640;
var height = 360;
var c = document.getElementById("offscreen");
var ctx = c.getContext("2d");
ctx.fillStyle = 'black'
@amiller
amiller / glass.html
Created March 25, 2014 14:32 — forked from bwhite/glass.html
[wearscript] Big to Glass Calibration
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
// Changes canvas color with head rotation
@amiller
amiller / glass.html
Created March 25, 2014 05:27 — forked from bwhite/glass.html
[wearscript] AR Warp with circles
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="offscreen" width="640" height="360" style="display:hidden"></canvas>
<script>
function drawCircle(x, y) {
var width = 640;
var height = 360;
var c = document.getElementById("offscreen");
var ctx = c.getContext("2d");
ctx.fillStyle = 'black'
@amiller
amiller / glass.html
Created March 20, 2014 23:04 — forked from bwhite/glass.html
[wearscript] Example AR Warp
<html style="width:100%; height:100%; overflow:hidden">
<head>
<script src="http://webgl-mjs.googlecode.com/hg/mjs.js" type="text/javascript"></script>
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="offscreen" width="1280" height="720" style="visibility:hidden"></canvas>
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
var d = [1, 2, 0, 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
var e = [5, 6, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
// Changes canvas color with head rotation
@amiller
amiller / hashvaluehighway.ml
Last active December 3, 2018 07:11
High-Value Hash Highway
(* Andrew Miller March 2014
Hash-value Highway - See also: https://bitcointalk.org/index.php?topic=98986 *)
open Merkle (* provides authtype *)
type tx = string
type block = Genesis | Blk of block authtype * block authtype * tx * int * int
(* Boiler plate for authenticated data structure parser
Indicates data structure definitions end here *)

Bitcoin provides Broadcast in a model where it's not clear otherwise how to get it.

Most distributed systems network models assume there is some kind of pre-established authenticated communication channel among a fixed set of participants, for example a PKI. Bitcoin is meant to work in a weaker model where there is no such assumption. Instead Bitcoin relies on a non-standard assumption about the allocation of computational resources - ignoring incentives for now, the assumption is that honest parties contribute more power in total than the adversary.

Some pre-established communication channel must still be assumed, just not an authenticated one. When formalizing Bitcoin things, I usually call it a "synchronous message diffusion" channel. Any honest party can publish a message, and that message is delivered to every other honest party within some time bound. A party that receives a message does not learn the identity of the sender (this essentially makes Sybil attacks possible). Additionally, the advers

@amiller
amiller / glass.html
Created March 2, 2014 01:37
[wearscript]
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
// Changes canvas color with head rotation
@amiller
amiller / glass.html
Created February 15, 2014 19:53
[wearscript] Tap to calibrate
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
// Changes canvas color with head rotation