Skip to content

Instantly share code, notes, and snippets.

Michael Bumann bumi

View GitHub Profile
View gist:1b6de0f8b2b47a458f7a779264268521
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
View acl-debug.sol
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 Feb 9, 2019
quck example to use the blockstream_satellite ruby gem
View satellite.rb
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
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
@bumi
bumi / bitstamp.js
Created Apr 25, 2018
streams all bitstamp buy/sell order updates and trades
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):
You can’t perform that action at this time.