Skip to content

Instantly share code, notes, and snippets.

Sjors Provoost Sjors

Block or report user

Report or block Sjors

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Sjors
Sjors / bitcoin-pay.rb
Last active Sep 11, 2019
This script demonstrates how a bitcoin transaction is created and signed. Just pass in your own address and private key and it will prepare a transaction for you. You can then copy & paste that transaction into a webservice like Blockchain to send it. I wrote this mostly to understand better how it works. I sometimes had to "cheat" and look at t…
View bitcoin-pay.rb
#!/usr/bin/env ruby
require 'open-uri'
require 'JSON'
require 'digest/sha2'
require 'pry'
require 'bigdecimal'
require 'bitcoin' # Because I need to cheat every now and then
# Usage:
# gem install pry json ffi ruby-bitcoin
View master @ 7d6f63cc2c2b9c4f07a43619eef0b7314474fffd
find output/ -type f -print0 | sort -z | xargs -r0 sha256sum
41c3b48d14163975f4fd27548a904b77fd3c8c816877f699add061871a1cae89 output/bitcoin-0.18.99-aarch64-linux-gnu-debug.tar.gz
f0ebbc072f5c1b5786e4468690396d7cf4522afef11b639e944f7b6d37760eec output/bitcoin-0.18.99-aarch64-linux-gnu.tar.gz
2c7358a14f8ffb25b5f3678e33d9ed94a17b0f8ed2523fc9d319aac3d7ccd025 output/bitcoin-0.18.99-arm-linux-gnueabihf-debug.tar.gz
34d7e7bc97f274d526042bc16a6bfdb9eccb96c9cf0b5eff269e07db27d2f1bd output/bitcoin-0.18.99-arm-linux-gnueabihf.tar.gz
912764cb7f740185d44658eadc817990b2cd08ae5c3db6135cacefa99244a5b6 output/bitcoin-0.18.99-i686-linux-gnu-debug.tar.gz
13a42d9dafa7a223c2c2d30b3fbf0d92ad2050480ae60d8f683f7142149779bd output/bitcoin-0.18.99-i686-linux-gnu.tar.gz
a1be0c8a543320237903c8b6f2848dc6112524a5f2979faf678aaf1cc9c79ad7 output/bitcoin-0.18.99-riscv64-linux-gnu-debug.tar.gz
62c5cae9eda45884be34ee25e2dc446ed1792a78f73f30d326f4e698bec6fa3e output/bitcoin-0.18.99-riscv64-linux-gnu.tar.gz
831ea3ccdb21f3be8483dd52c2ec7
@Sjors
Sjors / robot_user_agents.rb
Created Aug 3, 2011
Recognize search engines and spammers using user-agents.org
View robot_user_agents.rb
require 'net/http'
require 'xmlsimple'
url = "http://www.user-agents.org/allagents.xml"
xml_data = Net::HTTP.get_response(URI.parse(url)).body
data = XmlSimple.xml_in(xml_data)
agents = data['user-agent'].select{|agent| type = agent["Type"].first; type.include?("R") || type.include?("S")}
agent_names = agents.collect {|agent| agent["String"].first}
@Sjors
Sjors / magic.sh
Created May 7, 2019
Install Bitcoin Core from Gitian
View magic.sh
sudo tar -xzvf /home/gitian/bitcoin-binaries/0.18.0/bitcoin-0.18.0-x86_64-linux-gnu.tar.gz -C /usr/local --strip 1
@Sjors
Sjors / README.md
Created May 6, 2019
LibrePatron without Docker (Ubuntu)
View README.md

Warning: this is highly experimental

It assumes you're already running BTCPay Server somehwere.

Create a user and group:

sudo adduser patron --disabled-password
@Sjors
Sjors / bitcoin.conf
Created Aug 26, 2018
Bitcoin Core remote dev
View bitcoin.conf
testnet=1
[main]
[test]
server=1
rpcpassword=bitcoin
rpcuser=bitcoin
View Bitcoin EC2 Performance test.md

EC2 settings

  • Instance type: t2.xlarge
  • vCPUs: 4
  • Memory (GiB): 16
  • General Purpose SSD (GP2): 200 GB
  • Ubuntu
  • Running in eu-central-1b (Frankfurt)

Hint: to make your life easier and allow login with a simple ssh btc-0.14, edit ~/.ssh/config:

@Sjors
Sjors / 2018-03 Code Block London.md
Last active Mar 24, 2018
Anatomy of a bitcoin transaction
View 2018-03 Code Block London.md

footer: 2018-03-24 - Code Block London - sjors@sprovoost.nl - @provoost on Twitter slidenumbers: true autoscale: false

Bitcoin's Moving Parts

  • Coins
  • Digital signatures
@Sjors
Sjors / fetch_and_sign.sh
Last active Feb 17, 2018
Fetches gitian assert files from VM and signs them on host machine
View fetch_and_sign.sh
#!/bin/sh
SIGNED_BINARIES=0
while getopts ":n:v:s" opt; do
case $opt in
n)
NAME=$OPTARG
;;
v)
VERSION=$OPTARG
@Sjors
Sjors / steps.md
Created Jan 4, 2018
Convert (BitPay) BIP-70 payment request protocol buffer to JSON
View steps.md

Create payment request using their demo site. Obtain URL from QR code, e.g. on OSX using QR Journal.

You can’t perform that action at this time.