commit 3b08452cfd9f4be7dccbe389d4158e3d33b95774
parent 874fc2096cdc12c099a1aa9796029067bc6bfbef
Author: William Casarin <jb55@jb55.com>
Date: Mon, 7 Nov 2022 13:32:43 -0800
Merge remote-tracking branch 'refs/remotes/origin/master'
Diffstat:
15 files changed, 131 insertions(+), 8 deletions(-)
diff --git a/bin/btc-fetchblocks b/bin/btc-fetchblocks
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+
+BITCOIN_RPCUSER=rpcuser
+BITCOIN_RPCPASS=rpcpass
+BITCOIN_RPCPORT=${BITCOIN_RPCPORT:-8332}
+BITCOIN_HOST=${BITCOIN_HOST:-127.0.0.1}
+
+mkreq () {
+ (
+ printf '['
+ echo ${1#","}
+ printf ']'
+ )
+}
+
+doreq() {
+ local host="http://${BITCOIN_HOST}:${BITCOIN_RPCPORT}"
+ mkreq "$1" |
+ curl -s -u $BITCOIN_RPCUSER:$BITCOIN_RPCPASS \
+ --data-binary @- \
+ -H 'content-type: text/plain;' "$host"
+}
+
+make_hash_reqs() {
+ xargs printf ',{"jsonrpc": "1.0", "id":"blockhashes", "method": "getblockhash", "params": [%d] }\n'
+}
+
+make_block_reqs() {
+ xargs printf ',{"jsonrpc": "1.0", "id":"blocks", "method": "getblock", "params": ["%s", 2] }\n'
+}
+
+block_reqs=$(
+doreq "$(make_hash_reqs)" |
+jq -cr '.[].result' |
+make_block_reqs
+)
+
+doreq "$block_reqs" | jq -cr '.[].result'
diff --git a/bin/btc-fetchtxs b/bin/btc-fetchtxs
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+BITCOIN_RPCUSER=rpcuser
+BITCOIN_RPCPASS=rpcpass
+BITCOIN_RPCPORT=${BITCOIN_RPCPORT:-8332}
+BITCOIN_HOST=${BITCOIN_HOST:-127.0.0.1}
+
+mkreq () {
+ (
+ printf '['
+ echo ${1#","}
+ printf ']'
+ )
+}
+
+doreq() {
+ local host="http://${BITCOIN_HOST}:${BITCOIN_RPCPORT}"
+ mkreq "$1" |
+ curl -s -u $BITCOIN_RPCUSER:$BITCOIN_RPCPASS \
+ --data-binary @- \
+ -H 'content-type: text/plain;' "$host"
+}
+
+make_reqs() {
+ xargs printf ',{"jsonrpc": "1.0", "id":"get_txids", "method": "getrawtransaction", "params": ["%s", 1] }\n'
+}
+
+txid_reqs=$(make_reqs)
+
+doreq "$txid_reqs" | jq '.[].result'
diff --git a/bin/btc-mempooltxs b/bin/btc-mempooltxs
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+bcli getrawmempool false | jq -r '.[]' | btc-fetchtxs
diff --git a/bin/ffdesktop b/bin/ffdesktop
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+ffmpeg -f x11grab -s 1920x1080 -i :0.0 -preset ultrafast -vcodec libx264 -tune zerolatency -b 900k -f mpegts udp://192.168.87.100:55000
diff --git a/bin/ffkms b/bin/ffkms
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+
+ffmpeg \
+ -f kmsgrab \
+ -thread_queue_size 64 \
+ -i - \
+ -vf 'hwmap=derive_device=vaapi,hwdownload,format=bgr0,scale=1280:720' \
+ -c:v libx264 \
+ -preset:v superfast \
+ -tune zerolatency \
+ -intra-refresh 1 \
+ -f mpegts \
+ -b:v 3M \
+ udp://10.100.0.2:55000
+
+ #-f pulse \
+ #-i 'alsa_output.pci-0000_26_00.1.hdmi-stereo.monitor' \
diff --git a/bin/lnlink b/bin/lnlink
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+nodehost=$(lightning-cli getinfo | jq -r '. as $r | .address[0] | "\($r.id)@\(.address):\(.port)"')
+token=$(lightning-cli commando-rune "$@" | jq -r '.rune | @uri')
+echo "lnlink:$nodehost?token=$token"
diff --git a/bin/nannypay b/bin/nannypay
@@ -7,8 +7,6 @@ if [ -z "$NANNY" ]; then
exit 1
fi
-pay=25
-
if [ -z $pay ]; then
printf "unknown pay for %s\n" "$NANNY"
exit 1
@@ -16,6 +14,8 @@ fi
CSV="${NANNYPAY_CSV:-$HOME/.local/share/nannypay/${NANNY}.tsv}"
+
+set -e
mkdir -p "$(dirname "$CSV")"
if [ ! -f "$CSV" ]; then
touch "$CSV"
diff --git a/bin/nctor b/bin/nctor
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+nc -v -w 1 -x 127.0.0.1:9050 -z "$@"
diff --git a/bin/nostril b/bin/nostril
Binary files differ.
diff --git a/dotfiles/relays b/dotfiles/relays
@@ -0,0 +1,5 @@
+wss://relay.damus.io
+wss://nostr.bitcoiner.social
+wss://nostr-relay.wlvs.space
+wss://nostr-relay.freeberty.net
+wss://nostr-pub.wellorder.net
diff --git a/nix-config/environment/default.nix b/nix-config/environment/default.nix
@@ -35,7 +35,7 @@ let jb55pkgs = import <jb55pkgs> { inherit pkgs; };
tut
python3Packages.num2words
- python3Packages.howdoi
+ #python3Packages.howdoi
tree
datefmt
nncp
diff --git a/nix-config/hardware/desktop/default.nix b/nix-config/hardware/desktop/default.nix
@@ -84,7 +84,7 @@ in
EndSection
'';
- services.printing.drivers = [ pkgs.cups-brother-hll2370dw ];
+ #services.printing.drivers = [ pkgs.cups-brother-hll2370dw ];
boot.blacklistedKernelModules = ["dvb_usb_rtl28xxu"];
fileSystems."/media/kindle" =
diff --git a/nix-config/machines/monad/bitcoin/default.nix b/nix-config/machines/monad/bitcoin/default.nix
@@ -2,6 +2,10 @@ extra:
{ config, lib, pkgs, ... }:
let
+ jb55pkgs = import <jb55pkgs> { inherit pkgs; };
+
+ nostril = jb55pkgs.nostril;
+
nix-bitcoin = import (pkgs.fetchFromGitHub {
owner = "fort-nix";
repo = "nix-bitcoin";
@@ -34,7 +38,7 @@ let
addr = extra.private.btc-supplier-addr;
};
- walletemail = import ./walletemail.nix { inherit pkgs bcli; };
+ walletemail = import ./walletemail.nix { inherit pkgs bcli nostril; inherit (extra) private; };
spark-module = import ./modules/spark-wallet.nix nix-bitcoin.spark-wallet;
spark-port = 9962;
@@ -55,6 +59,14 @@ in
server_name wallet.jb55.com;
+ location /core/ {
+ alias /var/www/lnlink-core/;
+ }
+
+ location /cln/ {
+ alias /var/www/btcmerchant/;
+ }
+
location / {
proxy_pass http://127.0.0.1:9962;
diff --git a/nix-config/machines/monad/bitcoin/walletemail.nix b/nix-config/machines/monad/bitcoin/walletemail.nix
@@ -1,4 +1,4 @@
-{ pkgs, bcli }:
+{ pkgs, private, bcli, nostril }:
pkgs.writeScript "walletemail" ''
#!${pkgs.bash}/bin/bash
@@ -26,8 +26,10 @@ received="$(date -d @$(${pkgs.jq}/bin/jq -r '.timereceived' <<<"$tx"))"
export GNUPGHOME=/zbig/bitcoin/gpg
-msg="$(printf "txid: %s\n\naddress: %s\n\namount: %s\n\nconfirmations: %d\n\nwallet: %s\n\ntime: %s\n\nreceived: %s\n\nkeypath: %s\n\n%s\n\n\n%s" \
- "$txid" "$address" "$amount" "$confs" "$wallet" "$time" "$received" "$keypath" "$details" "$tx" )"
+msg="$(printf "txid: %s\n\naddress: %s\n\namount: %s\n\nconfirmations: %d\n\nwallet: %s\n\ntime: %s\n\nreceived: %s\n\nkeypath: %s\n\n%s\n" \
+ "$txid" "$address" "$amount" "$confs" "$wallet" "$time" "$received" "$keypath" "$details" )"
+
+${nostril}/bin/nostril --sec ${private.wallet-nostr} --envelope -p 32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245 --content "$msg" | ${pkgs.websocat}/bin/websocat ws://127.0.0.1:8080
enctx="$(printf "Content-Type: text/plain\n\n%s\n" "$msg" | ${pkgs.gnupg}/bin/gpg --yes --always-trust --encrypt --armor $keys)"
diff --git a/nix-config/machines/monad/default.nix b/nix-config/machines/monad/default.nix
@@ -416,6 +416,14 @@ in
# '';
# };
+ # for kmsgrab streaming
+ security.wrappers.ffmpeg = {
+ source = "${pkgs.ffmpeg}/bin/ffmpeg";
+ capabilities = "cap_sys_admin+ep";
+ owner = "root";
+ group = "root";
+ };
+
# security.pam.u2f = {
# enable = true;
# interactive = true;