Skip to content

Instantly share code, notes, and snippets.

View gist:e16298b0982e54aec8d9d084825e6312
*Main Data.Tree Data.Tree.Lens Control.Lens> let l = partsOf (traversed.(filtered ((==[]).subForest)))
*Main Data.Tree Data.Tree.Lens Control.Lens|
*Main Data.Tree Data.Tree.Lens Control.Lens> Node 1 [Node 2 [], Node 3 []] & l .~ [5,6]
<interactive>:7:1: error:
• Non type-variable argument in the constraint: Num (Tree a)
(Use FlexibleContexts to permit this)
• When checking the inferred type
it :: forall a. (Num (Tree a), Eq a) => Tree (Tree a)
View IndProp.v
Theorem add_le_cases : forall (n: nat) (m: nat) (p: nat) (q: nat),
n + m <= p + q -> n <= p \/ m <= q.
Proof.
intros.
generalize dependent p.
induction n.
- simpl.
intros.
apply or_introl.
apply le_0_n.
View mypy-protocol-demo.py
from typing import Protocol
class InterfaceAB(Protocol):
def method_a(self) -> None: ...
def method_b(self) -> None: ...
class ClassA:
def method_a(self) -> None:
print("a")
@ysangkok
ysangkok / geelightning failure
Created Feb 16, 2020
connecting to the HK bitcoin association node
View geelightning failure
janus@janus-UX305CA ~/geewallet
% mono src/GWallet.Frontend.Console/bin/Debug/GWallet.Frontend.Console.exe
*** STATUS ***
Account 1:
Currency=[BTC] Address=[3DTTymehP7s73gJFok8DKpVywb7mp6qKCN]
Balance=[0.00036] ~ 3.56 USD
History -> https://www.smartbit.com.au/address/3DTTymehP7s73gJFok8DKpVywb7mp6qKCN
Account 2:
View gist:de4790b09e90225297030641ae1c1088
(ns hello-test (:require [secp256k1.core :as secp256k1] [clojure.test :as test]))
(def rs-pub
(secp256k1/public-key "028d7500dd4c12685d1f568b4c2b5048e8534b873319f3a8daa612b469132ec7f7") )
(def ls-priv
(secp256k1/private-key (hello/fromhex "1111111111111111111111111111111111111111111111111111111111111111")))
(= (seq (.getEncoded (secp256k1/public-key ls-priv) true))
(seq (hello/fromhex "01034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa")))
View electrumx_bug_630.py
import threading
import asyncio
import time
import json
import subprocess
import colorama
import os
from utils import BitcoinRpc
from electrumutils import ElectrumX, ElectrumNode
View electrum_lnd_test
YOU NEED TO ADJUST PATHS IN THE TWO FOLLOWING SCRIPTS!!!
You need
- expect(1), package expect on Ubuntu
- bitcoind/bitcoin-cli 0.16 (with wallet. tested with 686e97a0c) in $PATH
- lnd (tested with 26f68da5b2883885fcf6a8e79b3fc9bb12cc9eef)
- electrum on lightning
- electrumx
- jq ('lightweight and flexible command-line JSON processor')
View gist:7ce3e7c6346a3b9b035481769176f00d
import socket
import asyncio
futs = []
for i in range(100):
t = asyncio.get_event_loop().getaddrinfo("aa000000aa"+str(i)+".onion.", 80)
futs.append(t)
print(asyncio.get_event_loop().run_until_complete(asyncio.gather(*futs, return_exceptions=True)))
View dump_lnd_sighash_preimage.diff
--- vendor/github.com/roasbeef/btcd/txscript/script2.go 2018-04-17 17:56:48.655160616 +0200
+++ vendor/github.com/roasbeef/btcd/txscript/script.go 2018-04-17 17:57:41.407045406 +0200
@@ -5,6 +5,7 @@
package txscript
import (
+ "encoding/hex"
"bytes"
"encoding/binary"
"fmt"
View gist:0b1f18d3982ee69ac1397e390239d423
bitcoind.conf:
regtest=1
txindex=1
printtoconsole=1
addrindex=1
rpcuser=doggman
rpcpassword=donkey
rpcbind=0.0.0.0
rpcallowip=127.0.0.1