Instantly share code, notes, and snippets.

View client.rb
# initialize a client
client = Faraday.new(url: 'https://lightning-2pdf.herokuapp.com/') do |faraday|
faraday.use FaradayLnPaywall::Middleware, { max_amount: 100 }
faraday.adapter Faraday.default_adapter
end
# use the client to do API calls:
puts client.post("/convert/pdf", "# Hallo Welt").body
View lnd.conf
[Application Options]
lnddir=/home/bitcoin/lnd_data
maxpendingchannels=10
alias=YOURALIAS
rpclisten=0.0.0.0:10009
[Bitcoin]
bitcoin.active=1
bitcoin.mainnet=1
bitcoin.node=bitcoind
View bitcoin.conf
# use https://jlopp.github.io/bitcoin-core-config-generator/ to generate your config file
datadir=/home/bitcoin/bitcoind_data
txindex=1
disablewallet=1
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
View bitstamp.js
const { LiveOrderStream, TickerStream, CURRENCY } = require("node-bitstamp");
const liveOrderStream = new LiveOrderStream();
const liveOrderTopic = liveOrderStream.subscribe(CURRENCY.BTC_EUR);
liveOrderStream.on("connected", () => { console.log('connected to live orders'); });
liveOrderStream.on("disconnected", () => { console.log('disconnected'); });
liveOrderStream.on(liveOrderTopic, data => {
console.log(`${data.id}: ${data.order_type === 1 ? 'SELL' : 'BUY'} ${data.amount}@${data.price}`);
View hello@michaelbumann.com
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFkc1LABEADPxWo+iKVoh6XdA7S5vG7guUwUw3cfS9UTmC496dT06/frs6vB
RvnEKLIsAxorn0AJbWum+rWRazOsJV96anLPvRqJH2XCWNRnGqByGc4b2wEWQLnW
5bR0FyeRYZxgFKsse//UcXivMUXTVXbdgpzpWRZDsN6qhFLUowz8mpsnUjmix0XA
OEtBIbjN9e7RAIJDw/FcS0PaL/SPOcx1o0Jg9nRSkwm8UaxXKeVKnPxS+83RiYl3
tRubUhi3qAHBpWp+iZhlUi+7XxyOAKU4a8RO8aa58Fge3/XjZ7wBRSBsMOwgqlU2
NFcaNwGqukpvtx4XC9fVL84SAt50llYSfZNczPFcWndprsoiFUUCGY6SBnC4hamC
VjQBNBO1zk2kKuHErsp1+eSJrud3xwiWr9/Uu81HvT00iDSjFSDM6GE7q/poGdte
zdUOMBtL+TpPJCFm4fb+NmqgtyCqTV2+lvumHIikeFB+Wl3KPn+7InlQcNpAIpJV
View blog.py
from peewee import CharField, TextField, ForeignKeyField
from peewee import Model, SqliteDatabase
import post # !!!! imports post which imports blog
class Blog(Model):
title = CharFiled()
body = TextField()
def import_posts(self, backup):
View multiple-outputs.java
Coin recipientAmount = (total wallet amount) - fees needed / this.recipients.length // if not dividable the rest should be ignored and go to the miners. I don't want change
// create a new transactions with the NetworkParameters
Transaction sendTx = new Transaction(params);
// add the outputs
for(String address : this.recipients){
sendTx.addOutput(recipientAmount, Address.fromBase58(params, address));
}
View payment_request.rb
# also have a look at the nice Takecharge Server: https://github.com/controlshift/prague-server and its BOP70 implementation this is based on
class PaymentRequest
def initialize(options)
@options = options
output = create_output
details = create_payment_details(output)
@payment_request = Payments::PaymentRequest.new
View example.rb
require 'sinatra/base'
# wrapper to easily translate tap coordinates to readable methods
class Calculate
PAD = {
'1' => [100, 1200],
'2' => [400, 1200],
'3' => [700, 1200],
'4' => [100, 1350],
'5' => [400, 1350],
View bitcoin-example.php
<?php
/*
EXAMPLE TO CREATE A NEW BITCOIN PAYMENT
======================
- User enters all the payment details.
- after the user has entered his details and selects to pay,
we make a request to create a new bitcoin invoice.