Skip to content

Instantly share code, notes, and snippets.

View Sjors's full-sized avatar

Sjors Provoost Sjors

View GitHub Profile
@Sjors
Sjors / 2018-03 Code Block London.md
Last active March 24, 2018 13:13
Anatomy of a bitcoin transaction

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 April 10, 2021 21:24
Fetches gitian assert files from VM and signs them on host machine
#!/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 January 4, 2018 11:05
Convert (BitPay) BIP-70 payment request protocol buffer to JSON

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

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 / .gitignore
Last active September 8, 2022 03:15
node_modules
*.pdf
@Sjors
Sjors / Makefile
Last active August 29, 2015 14:02
Makefile to generate iOs icons from an SVG.
resolutions := 58 76 80 120 152
all_FILES := $(foreach resolution, $(resolutions), icon-$(resolution).png)
all: $(all_FILES)
icon-%.png: icon-itunes-connect-1024.png
convert $< -resize $*x$* $@
icon-itunes-connect-1024.png: icon.svg
@Sjors
Sjors / bitcoin-pay.rb
Last active April 9, 2024 16:50
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…
#!/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
@Sjors
Sjors / gist:5356176
Last active December 16, 2015 01:38
Observe and notify user if app has moved
// Observe and notify user if app has moved:
[[NSNotificationCenter defaultCenter] addObserverForName:@"AppHasMoved"
object:nil
queue:NSOperationQueuePriorityNormal
usingBlock:^(NSNotification *note) {
// Check if we've already told the user recently
NSDate *appHasMoved = [[NSUserDefaults standardUserDefaults] valueForKey:@"AlertAppHasMoved"];
int interval = 7*24*60*60;
if (appHasMoved == nil ||
[appHasMoved compare:[[NSDate date] dateByAddingTimeInterval:-interval]] == NSOrderedAscending) {
NSNumber* appHasMoved = [JSON objectForKey:@"app_has_moved"];
if(appHasMoved != nil && [appHasMoved boolValue]) {
// Notify the user that the app has moved.
[[NSNotificationCenter defaultCenter] postNotificationName:@"AppHasMoved"
object:self
userInfo:@{
@"new_app_location" : [JSON objectForKey:@"new_app_location"],
@"app_has_moved_message" : [JSON objectForKey:@"app_has_moved_message"],
@"app_has_moved_title" : [JSON objectForKey:@"app_has_moved_title"]
}
{
'app_has_moved' : true,
'new_app_location' : "https://itunes.apple.com/nl/app/your_new_app/idNEW_APP_ID?mt=8",
'app_has_moved_message' : "In order to stay current, please re-download the app from this location. Apologies for the inconvenience."
}