Skip to content

Instantly share code, notes, and snippets.

View bumi's full-sized avatar

Michael Bumann bumi

View GitHub Profile
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://ipfs.kosmos.org:5444/api/v0/id?stream-channels=true. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
=> https://github.com/INFURA/tutorials/wiki/IPFS-and-CORS#configuration-of-cors
=> https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin?utm_source=devtools&utm_medium=firefox-cors-errors&utm_campaign=default
hallo
pragma solidity ^0.5.6;
contract Auth {
enum Op { NONE, EQ, NEQ, GT, LT, GTE, LTE, RET, NOT, AND, OR, XOR, IF_ELSE }
bytes32 paramHash;
mapping (bytes32 => bytes32) public permissions; // permissions hash => params hash
mapping (bytes32 => Param[]) public permissionParams; // params hash => params
@bumi
bumi / satellite.rb
Created February 9, 2019 22:00
quck example to use the blockstream_satellite ruby gem
require "blockstream_satellite"
order = BlockstreamSatellite::Order.create(path: '/path/to/file')
puts order.status #=> pending
order.pay # sends the lightning payment using the configured lnd client
puts order.status #=> transmitting
order.refresh
puts order.status #=> sent
@bumi
bumi / client.rb
Last active November 22, 2018 21:44
# 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
# 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
@bumi
bumi / bitstamp.js
Created April 25, 2018 15:43
streams all bitstamp buy/sell order updates and trades
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}`);
<?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.
@bumi
bumi / blog.py
Last active February 24, 2017 04:39
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):
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));
}