Skip to content

Instantly share code, notes, and snippets.

// Convert decimal difficulty to target hex
function difficultyToTarget(difficulty) {
// maxTarget is the hex target for difficulty 1
const maxTarget = BigInt("0x00000000FFFF0000000000000000000000000000000000000000000000000000");
// Convert difficulty to BigInt and handle decimal places
const difficultyBigInt = BigInt(Math.floor(difficulty * 100000000)) / BigInt(100000000);
// Calculate target: maxTarget / difficulty
const target = maxTarget / difficultyBigInt;
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I'm jaonoctus, in control of my PGP key 0x782C165A293D6E18.
writing this and signing with my new subkey ed25519/0x4FE21F5FFF84C9BC created at 2024-10-08 that will expire at 2025-10-08.
Latest bitcoin block hash:
00000000000000000000e1eba946427ab210ec3b9d9d3f7cedd93a73228c38ab
-----BEGIN PGP SIGNATURE-----
testnet=1
rpcauth=bitcoin:1cbc10237553f3b301516af8c1a74ad1$a8606448b6b01a2e63639d58111b92773c89b42b9435009b6f03bd2199446afc
zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
[network]
listen=1
whitelist=0.0.0.0/0
[rpc]
#!/bin/bash
# dependencies: base58
# usage
# ./xpub-converter.sh <ZPUB> xpub
main () {
local input="$1"
local prefix="$2"
var base58 = require('bs58')
var { sha256 } = require('@noble/hashes/sha256')
const useBs58check = function (checksumFn) {
// Encode a buffer as a base58-check encoded string
function encode (payload) {
var payloadU8 = Uint8Array.from(payload)
var checksum = checksumFn(payloadU8)
var length = payloadU8.length + 4
var both = new Uint8Array(length)
@jaonoctus
jaonoctus / docker-compose-mempool.yml
Created January 6, 2024 11:58
Mempool.Space docker compose
version: '3.7'
services:
web:
image: mempool/frontend:v2.5.0
user: "1000:1000"
restart: on-failure
stop_grace_period: 1m
command: "./wait-for mariadb:3306 --timeout=720 -- nginx -g 'daemon off;'"
environment:
@jaonoctus
jaonoctus / docker-compose.yml
Last active February 14, 2023 04:20
taro docker-compose.yml for umbrel
version: "3"
services:
taro:
image: jaonoctus/taro:v0.1.99-alpha
command: --network=testnet --debuglevel=debug --lnd.host=10.21.21.9:10009
volumes:
- ./data:/root/.taro/
- ../umbrel2/app-data/lightning/data/lnd:/root/.lnd/
networks:
# with audio
ffmpeg -i video1.mp4 -vcodec libx264 -acodec aac video1_h264.mp4
# without audio
ffmpeg -i video1.mp4 -vcodec libx264 -an video1_h264.mp4

Linux Mint - LUKS encryption

You should create encryption on an empty Disk.

You can convert the existing unencrypted system to encrypted, but this is not trivial. (You should use live system to copy all of your old data to the new encrypted partitions...) Example:

#!/bin/bash
PENDRIVE_UUID="1a62326e-a62a-42d7-8836-50717257008a"
PENDRIVE_MOUNTPOINT="/mnt/pendrive"
LUKS_KEY_FILE="luks.key"
LUKS_UUID="e499077a-7040-4a4f-a668-60bcdfbc1a06"
LUKS_MOUNTPOINT="/mnt/storage"
DEVICES_FOLDER="/dev/disk/by-uuid/"
# check if pendrive is attached