Skip to content

Instantly share code, notes, and snippets.


John Small JohnSmall

View GitHub Profile
JohnSmall / bitcoin-pay.rb
Created Jul 28, 2018 — forked from Sjors/bitcoin-pay.rb
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
JohnSmall /
Last active Feb 19, 2017
Handy script to prepare a bare Digital Ocean droplet for Rails deployed via Capistrano
#! /bin/bash
# this is a useful little script to setup a rails user, with postgresql, and nginx version of Phusion Passenger on a Digital Ocean droplet
# Once run it's ready to recieve a Capistrano deployment.
# The best way to run it is ssh root@my_do_host 'bash -s' <
set -e -x # die on the first error and send stdout to /var/log/syslog
#create a password and save it
PWD=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1)
mkdir -p passwords
echo "rails,$PWD" >> passwords/users.txt
#create a user called rails and allow them to sudo without a password