Skip to content

Instantly share code, notes, and snippets.

Avatar

Janus Troelsen ysangkok

View GitHub Profile
@ysangkok
ysangkok / gist:95932655651884d5b371c6856afc27eb
Created Jan 11, 2022
`cabal build -v3` for hdbc with wider time bounds (ghc-9.2.1)
View gist:95932655651884d5b371c6856afc27eb
janus@gorm ~/flipstone/hdbc % cabal build -v3
File monitor 'config' unchanged.
this build was affected by the following (project) config files:
File monitor 'improved-plan' changed: monitor value changed
File monitor 'elaborated-plan' changed: monitor value changed
File monitor 'compiler' unchanged.
File monitor 'solver-plan' changed: monitor value changed
/home/janus/.ghcup/bin/ghc --print-global-package-db
Reading installed packages...
/home/janus/.ghcup/ghc/9.2.1/bin/ghc-pkg-9.2.1 dump --global -v0
@ysangkok
ysangkok / gist:37c9fac2023c121ba1814b700fd5aff2
Created Jan 11, 2022
testing whether it is possible to override time which is a boot package
View gist:37c9fac2023c121ba1814b700fd5aff2
File monitor 'config' unchanged.
this build was affected by the following (project) config files:
File monitor 'improved-plan' unchanged.
Installed HDBC-2.4.0.3 (HDBC-2.4.0.3-inplace)
base-4.16.0.0
bytestring-0.11.1.0
containers-0.6.5.1
convertible-1.1.1.0-dc3140c6fddd7b5dc449bcd78b8978c413f7f2345846c93a5e0d4d2cf8e28809
mtl-2.2.2
old-time-1.1.0.3-c69f0ca65ae504feb9bdb3925ff0d85519e6e62dcc25020e81c6fc1642136812
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)))