Skip to content

Instantly share code, notes, and snippets.

View leishman's full-sized avatar

Alexander Leishman leishman

  • River Financial
  • San Francisco, CA
  • X @leishman
View GitHub Profile
@gavinandresen
gavinandresen / BlockPropagation.md
Last active March 14, 2023 09:45
O(1) block propagation

O(1) Block Propagation

The problem

Bitcoin miners want their newly-found blocks to propagate across the network as quickly as possible, because every millisecond of delay increases the chances that another block, found at about the same time, wins the "block race."

@hmcfletch
hmcfletch / state_abbr_to_name.rb
Created June 2, 2011 23:14
Ruby hashes for converting states to abbreviations and back
STATE_ABBR_TO_NAME = {
'AL' => 'Alabama',
'AK' => 'Alaska',
'AS' => 'America Samoa',
'AZ' => 'Arizona',
'AR' => 'Arkansas',
'CA' => 'California',
'CO' => 'Colorado',
'CT' => 'Connecticut',
'DE' => 'Delaware',
@benschwarz
benschwarz / csrf-token.js
Created April 7, 2013 23:11
Set the CSRF token for Rails when doing Ajax requests
define( ['jquery'], function ( $ ) {
var token = $( 'meta[name="csrf-token"]' ).attr( 'content' );
$.ajaxSetup( {
beforeSend: function ( xhr ) {
xhr.setRequestHeader( 'X-CSRF-Token', token );
}
});
return token;

A pseudonymous trust system for a decentralized anonymous marketplace

Dionysis Zindros, National Technical University of Athens dionyziz@gmail.com

Keywords

pseudonymous anonymous web-of-trust identity trust bitcoin namecoin proof-of-burn timelock decentralized anonymous marketplace openbazaar

Abstract

@achow101
achow101 / bitcoin-core-hww.md
Last active November 16, 2021 15:08
How to Use Bitcoin Core with Hardware Wallets

Using Bitcoin Core with Hardware Wallets

This approach is fairly manual, requires the command line, and requires a patched version of Bitcoin Core.

Note: For this guide, code lines prefixed with $ means that the command is typed in the terminal. Lines without $ are output of the commands.

Disclaimer

I am not liable for any coins that may be lost through this method. The software mentioned may have bugs. Use at your own risk.

@fernandonm
fernandonm / bitcoin_derivatives.md
Last active May 29, 2019 08:03
Trust-minimized derivatives

Trust-minimized derivatives

Options contracts can be implemented as trust-minimized smart contracts using Bitcoin script. These contracts don't require oracles feeding the price into the blockchain or any other trusted third party. Recipients will only trust miners to mine (and not reverse) transactions paying a reasonable feerate, securing their payouts.

The underlier of these derivatives can be any digital asset available on a blockchain that can do HLTCs.

Call options

The buyer of an American-style call binary option pays a premium (eg: 0.1 BTC) for <seller secret> wich gives the right to buy Q units (quantity) of the underlying asset (100 LTC) at a specified strike price (0.016 BTC per LTC) at any time until the expiration date.

@spoike
spoike / webapi_example.js
Last active May 12, 2017 13:37
Simple WebAPI example
var PostsApi = require('webapi/posts'),
// assuming the api object from the jsbin snippet
Reflux = require('reflux');
var PostActions = createActions(["load", "loadError"]);
// load action is invoked either from:
// * top most component's componentDidMount
// function in your application, or
// * window.onLoad
// I prefer the first strategy because that'll
@stevenharman
stevenharman / devise_mail_helpers.rb
Created August 14, 2013 02:23
Extract Devises "raw" tokens from outgoing email, since the tokens stored in the DB have been digested. (As for Devise 3.1)
module Features
module MailHelpers
def last_email
ActionMailer::Base.deliveries[0]
end
# Can be used like:
# extract_token_from_email(:reset_password)
def extract_token_from_email(token_name)
@rthbound
rthbound / animated_moon.rb
Last active August 29, 2015 13:57
Make a gif of the Moon as seen from Earth for one lunar year, starting now - http://gfycat.com/SilverPositiveBluet
require "usno/imagery"
require "open-uri"
require "RMagick"
include Magick
def animate(n,f)
i=0
time = Time.now