Skip to content

Instantly share code, notes, and snippets.

View martindale's full-sized avatar
🚀
relentless maker.

Eric Martindale martindale

🚀
relentless maker.
View GitHub Profile
@martindale
martindale / bitcoin-micropayment-protocol.md
Created February 27, 2014 18:34
General flow for micropayment channels in Bitcoin.
  1. Create a public key (K1). Request a public key from the server (K2).
  2. Create and sign but do not broadcast a transaction (T1) that sets up a payment of (for example) 10 BTC to an output requiring both the server's public key and one of your own to be used. A good way to do this is use OP_CHECKMULTISIG. The value to be used is chosen as an efficiency tradeoff.
  3. Create a refund transaction (T2) that is connected to the output of T1 which sends all the money back to yourself. It has a time lock set for some time in the future, for instance a few hours. Don't sign it, and provide the unsigned transaction to the server. By convention, the output script is "2 K1 K2 2 CHECKMULTISIG"
  4. The server signs T2 using its public key K2 and returns the signature to the client. Note that it has not seen T1 at this point, just the hash (which is in the unsigned T2).
  5. The client verifies the servers signature is correct and aborts if not.
  6. The client signs T1 and passes the signature to the server, which now broadca

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
"""
PyBitcoinMultiCast - A Bitcoin Local Node Discovery Test.
Loosely based on Aaron Cohen's code <https://gist.github.com/aaroncohen/4630685>
BTC: 1Bardi4eoUvJomBEtVoxPcP8VK26E3Ayxn
LTC: LcSVL3Mj5VLSDzkwyBjufKemEVMbaC7vfp
DOGE: DKvVt6sapm6NwuWGMrcV3wVhxnrn853NFS
Licenced under The MIT License <http://opensource.org/licenses/MIT>.
@martindale
martindale / README.md
Last active August 29, 2015 14:03
README.md Template

Getting Started

Overview

One or two paragraph introduction on the objective of this library.

Quick Start

If you are unsure of our project and just want to play around, you can get things set up quickly by:

@martindale
martindale / Key.prototype.js
Created July 31, 2014 22:35
getters / setters for keygen
Key.prototype = {
get public() {
return this._public;
},
set public(k0) {
this._public = k0.toPublic();
}
};
@martindale
martindale / extract-music.js
Created August 18, 2014 21:54
extract an array of tracks from a Google Music playlist table
var playlist = $('table tr.song-row');
var tracks = [];
playlist.each(function(i , row) {
var $track = $( row );
var title = $( $track.children()[0] ).text();
var artist = $( $track.children()[2] ).text();
tracks.push( artist + ' – ' + title );
@martindale
martindale / queue-to-playlist.js
Created September 13, 2014 22:45
add all currently queued tracks to a specific playlist
var username = 'martindale';
var playlistID = '5414c5fadda8bb926e0017e4';
$.getJSON('/playlist.json', function(tracks) {
tracks.map(function(x) {
return x._id;
}).forEach(function(trackID) {
$.post('/' + username + '/playlists/' + playlistID, {
trackID: trackID
}, function(res) {
@martindale
martindale / find-things-todo.sh
Created September 25, 2014 21:46
Find TODOs in Source
git grep -I -P -i '\b(TODO|FIXME|XXX)\b'

The following is a partial annotated bibliography of SNI Mempool, building the case for why Bitcoin will displace all competing currencies, including altcoins, fiat money, and precious metals:

In terms of monetary policy, Bitcoin is the greatest money the world has ever seen.

Unsurprisingly, it has gained substantial popularity, and there is no reason to believe it will not continue to grow.