Skip to content

Instantly share code, notes, and snippets.

Proof of concept DLC channels

DLC channels combine the ideas of Discreet Log Contracts and bidirectional payment channels (without the Lightning network) on top of Bitcoin Lightning Network. It is one of the first settlement implementation of Debnk protocol.

We believe that DLC channels can be also implemented on top of Elements/Liquid, but probably without confidential transactions. (TODO: Verify)

Discreet log contracts

Discreet log contracts are simple contracts that use on-chain multisig capability. Let's say that Alice and Bob want to enter an (inverse) perpetual swap contract based on the price of Bitcoin in USD. Alice goes long 1000 USD, Bob goes short 1000 USD. They both post some collateral (let's say 0.05 BTC each). The price of Bitcoin is 8000 USD at the time of the opening of the contract. The contract expires and the funds are distributed based on the price of Bitcoin on Friday noon.

@jooray
jooray / opt-add-monerod-listen.custom
Created November 10, 2020 12:47
A docker-compose fragment for btcpayserver to expose monerod RPC port to localhost. I am running a full node, let's make it accessible to my wallets!
version: "3"
services:
monerod:
ports:
- "127.0.0.1:18081:18081"
@jooray
jooray / yt-whisper
Created February 5, 2023 21:09
A script to download an audio from a video from a streaming platform such as youtube and transcribe it to text using whisper.cpp
#!/bin/bash
# Usage: yt-whisper URL [OUTPUT_FILENAME_TEMPLATE [LANGUAGE]]
# If OUTPUT_FILENAME_TEMPLATE is empty, output is yt-whisper-video
# If LANGAUGE is empty, it is set to "auto"
# General settings (paths) for whisper.cpp
# Note - this uses whisper.cpp, not official whisper. Get it at
# https://github.com/ggerganov/whisper.cpp
# You will have to adjust these
@jooray
jooray / whisper-file
Last active January 20, 2025 13:05
Use whisper speech to text on an audio or video file regardless of codec, autodetect language
#!/bin/bash
# Usage: whisper-file FILE [LANGUAGE] [OPTIONS...]
# If LANGUAGE is empty, it is set to "auto"
# Any additional options are passed directly to ${WHISPER_BIN}
# General settings (paths) for whisper.cpp
# Note - this uses whisper.cpp, not official whisper. Get it at
# https://github.com/ggerganov/whisper.cpp
WHISPER_MODEL=/Users/test/whisper.cpp/models/ggml-large.bin
@jooray
jooray / alpacoom-mps.py
Created March 28, 2023 14:42
Running alpacoom model on MPS (Apple Silicon) using HuggingFace Transformers and Peft
import os
import torch
from peft import PeftModel, PeftConfig
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
import sys
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
peft_model_id = "mrm8488/Alpacoom"
@jooray
jooray / chat-vicuna.sh
Created April 8, 2023 16:58
A modified chat-13B.sh script from llama.cpp to change prompt to the style vicuna model was trained.
#!/bin/bash
cd "$(dirname "$0")/.." || exit
MODEL="${MODEL:-./models/13B-vicuna/ggml-vicuna-13b-4bit-rev1.bin}"
USER_NAME="${USER_NAME:-Human}"
AI_NAME="${AI_NAME:-Assistant}"
# Adjust to the number of CPU cores you want to use.
N_THREAD="${N_THREAD:-8}"
@jooray
jooray / monero-search.js
Created April 13, 2023 21:47
A way to search for monero transactions with particular inputs in ring groups
const monerojs = require('monero-javascript');
const cliProgress = require('cli-progress');
async function scanForInputs() {
// parameters
const rpc = await monerojs.connectToDaemonRpc('http://localhost:18081');
const min_height = 2853173;
@jooray
jooray / lnbank_balances.md
Created February 29, 2024 18:45
How to settle lnbank balances after lnbank being deprecated

Connect to PSQL:

docker exec -it $(docker ps -a -q -f "name=postgres_1") psql -U postgres -d btcpayservermainnet
set search_path to "BTCPayServer.Plugins.LNbank";

Then you can see wallets:

@jooray
jooray / eso-level-estimator.md
Last active September 15, 2024 12:28
Eso level estimator 8000 - prompt for LLMs

You are an eso level estimator bot. Today is {current_date}. You are going to output an eso level (level of esotericness) based on the following scale:

0 - 🔢 facts deriving through logic from axioms, praxeology

1 - 🧪 physics, chemistry, gold as money

2 - 📈 results based on studies with theory of causality, computer science

3 - 👓 observational studies, studies on small samples, observed results without established theory of causality

@jooray
jooray / translation_diff.py
Created July 7, 2024 08:32
Diff for Android app translation xml files
# A script which takes a reference file (usually English), a translated file and outputs
# strings that need to be translated.
#
# Used for Slovak translation of Phoenix Wallet Android app
# Before using, run:
# pip install lxml
from lxml import etree
import sys