Skip to content

Instantly share code, notes, and snippets.

use futures_util::stream;
use rand::rngs::ThreadRng;
use rand::Rng;
// This program connects to LND and prints out all intercepted htlc's as they settle.
// This program accepts four arguments: host, port, cert file, macaroon file
#[tokio::main]
async fn main() {
let mut args = std::env::args_os();
@yzernik
yzernik / sell-example.py
Last active December 21, 2020 03:21
Lightning network PTLC payment point example. Requires "pip install ECPy"
import os
from ecpy.ecschnorr import ECSchnorr
from ecpy.curves import Curve,Point
from ecpy.keys import ECPublicKey, ECPrivateKey
from ecpy.formatters import decode_sig, encode_sig, list_formats
from ecpy import ecrand
from ecpy.curves import ECPyException
@yzernik
yzernik / gist:a359d2cb899e1deb24cb
Created December 17, 2015 07:45
CAP theorem reading
https://martin.kleppmann.com/2015/05/11/please-stop-calling-databases-cp-or-ap.html
@yzernik
yzernik / gist:57164897444cc6fb5956
Created July 9, 2015 23:03
Predator-Prey Modeling in Clojure
http://fn-code.blogspot.com/2015/04/predator-prey-modeling-in-clojure.html
@yzernik
yzernik / gist:e380837b9dc2a578a2b3
Created June 25, 2015 20:08
Dynamic dispatch in Scala
http://cleverlytitled.blogspot.com/2010/01/dynamic-dispatch-in-scala.html
@yzernik
yzernik / gist:d759e00697a5150560dd
Created June 25, 2015 02:37
Get Google Finance quote session and channel
## Get the SID
curl 'https://www.google.com/finance/qs/channel?VER=8&RID=40689&CVER=1&zx=f0u709om2rkm&t=1' -H 'Referer: https://www.google.com/finance/_/js/a/b/rt=h/ver=2gMDYVmDK2c.en_US./am=!vutE9fCSVdws1JA_/d=0' -H 'Origin: https://www.google.com' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.125 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' --data 'count=0' --compressed
## Get the stream channel
curl 'https://www.google.com/finance/qs/channel?VER=8&RID=rpc&SID=F2431585066298B&CI=0&AID=0&TYPE=xmlhttp&zx=9xroy71am1r&t=1' -H 'Referer: https://www.google.com/finance/_/js/a/b/rt=h/ver=2gMDYVmDK2c.en_US./am=!vutE9fCSVdws1JA_/d=0' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.125 Safari/537.36' --compressed
@yzernik
yzernik / gist:acb29e65ca63e9826b22
Last active August 29, 2015 14:22
core.logic readings
https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer
https://github.com/swannodette/logic-tutorial
https://github.com/clojure/core.logic/wiki/Examples
http://tgk.github.io/2012/08/finding-cliques-in-graphs-using-core-logic.html
http://martinsprogrammingblog.blogspot.com/2012/09/some-corelogic-graph-code.html
http://decomplecting.org/blog/2014/10/29/reify-this/
@yzernik
yzernik / gist:a904b45a13afa7507f38
Created May 21, 2015 23:49
Generating Text with Recurrent Neural Networks
http://www.cs.toronto.edu/~ilya/pubs/2011/LANG-RNN.pdf
@yzernik
yzernik / gist:2845ac298d12e3f7eed5
Created May 21, 2015 23:34
The Unreasonable Effectiveness of Recurrent Neural Networks
http://karpathy.github.io/2015/05/21/rnn-effectiveness/