Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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"

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 / keys.pub auth
Created May 11, 2020 10:04
keys.pub auth
BEGIN MESSAGE.
WlbNxS5zYPMlZD2 luUjoVuqpehn4lu 7GOTkpFbxN8l2iK arNa57hbs0SHERZ
MEgsd7ug647Bxrs 8veqIOcLcoNTCKq 6Xr2MZHgg6NbhWm k2yIIcYZHQ397Ru
TdUBTc5LFCf5oT9 iMZxgjEMKocEulm EeILzZyKntDUlgG 90S1g2SNoR0tuL5
27EIx4aprCwBQgM vBbYtCMq0PJip8a BT1QA21.
END MESSAGE.
@jooray
jooray / optimize-images.sh
Last active January 3, 2020 21:59
optimize images
#!/bin/bash
dirs=( "/home/web1" "/home/web2" )
# run without "-mtime -3" for the first time, then put into cron
find "${dirs[@]}" -mtime -3 -name \*.png -exec optipng -preserve {} \;
find "${dirs[@]}" -mtime -3 \( -name \*.jpg -or -name \*.jpeg \) -exec jpegoptim {} \;
@jooray
jooray / # systemd - 2019-12-25_23-29-48.txt
Created December 25, 2019 22:34
systemd on 4.18.0-80.11.2.el8_0.x86_64 - Homebrew build logs
Homebrew build logs for systemd on 4.18.0-80.11.2.el8_0.x86_64
Build date: 2019-12-25 23:29:48
@jooray
jooray / transcribe.sh
Last active July 25, 2019 17:55 — forked from mmmaly/transcribe.sh
Call Google speech recognize
#!/bin/bash
# How to set it up:
# Create a project in Google Cloud admin console
# Install google cloud sdk (you need gcloud and gsutil commands)
# Install ffmpeg and jq
# Run gcloud init, login, answer the questions
# Under the project you created, create a globally unique bucket
# here: https://console.cloud.google.com/storage/browser
# set the name of the globally unique bucket name prefixed by gs://
# here
@jooray
jooray / install-lnd
Last active February 4, 2022 18:13
Install LND neutrino mainnet
#!/bin/bash
# Check the most recent LND_TAG at
# https://github.com/lightningnetwork/lnd/releases
export LND_TAG=1e511be523eb8e97c4e2d9c89a7a263963a3929f
# install lnd
git clone https://github.com/lightningnetwork/lnd $GOPATH/src/github.com/lightningnetwork/lnd
cd $GOPATH/src/github.com/lightningnetwork/lnd
git checkout $LND_TAG
# enabling mainnet on neutrino is in main branch since 0.8x, only uncomment for tag <0.8
#git fetch https://github.com/halseth/lnd.git mainnet-neutrino && git cherry-pick dbd3ca7be48027d8eda557e3c22268497ecc6b25
@jooray
jooray / secure-wordpress.conf
Created January 23, 2019 10:07
Securing wordpress in nginx
location ~ ^/wp-admin/includes/ {
return 403;
}
location ~ ^/wp-includes/[^/]+\.php$ {
return 403;
}
location ~ ^/wp-includes/js/tinymce/langs/.+\.php {
return 403;