Skip to content

Instantly share code, notes, and snippets.

@84adam
84adam / challenges.md
Created April 4, 2025 13:35 — forked from AdamISZ/challenges.md
Challenges (bitcoin, script, keys, crypto etc.)

(parentheses + italics = commentary, questions on how these challenges are structured. obviously not intended to be in the text for the students.)

Challenge 1: The fees are all mine(d) (3/10)

(This challenge is focused on not needing any coding skills and just discussing/knowing basic bitcoin mechanisms)

Tx number Fee /sats Weight Standard? Consensus valid? Spends from
1 58M 3.6M ✔️ ✔️ 4
@84adam
84adam / install-java-gradle.sh
Last active February 10, 2025 18:19
Install JDK 23.0.2 and Gradle 8.10.2 on Linux (x86_64, apt or dnf)
#!/bin/bash
set -eo pipefail
JDK_VERSION="23.0.2"
JDK_SHA="017f4ed8e8234d85e5bc1e490bb86f23599eadb6cfc9937ee87007b977a7d762"
JDK_URL="https://download.java.net/java/GA/jdk23.0.2/6da2a6609d6e406f85c491fcb119101b/7/GPL/openjdk-23.0.2_linux-x64_bin.tar.gz"
GRADLE_VERSION="8.10.2"
GRADLE_SHA="31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26"
GRADLE_URL="https://services.gradle.org/distributions/gradle-8.10.2-bin.zip"
@84adam
84adam / gist:02f25b50f0da6f5b1536156dff003a5e
Last active January 30, 2025 21:27
Open WebUI + Ollama + DeepSeek-R1-Distill-Qwen-1.5B
# HW Requirements
# I recommend 8 CPU cores and 16 GB of RAM on the system or VM if using the deepseek-r1:1.5b model
# 1. install docker
# e.g. see: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-rocky-linux-9
# 2a. assuming an Nvidia GPU is available, run:
`docker run -d -p 3000:8080 --gpus=all -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:ollama`
# 2b. if an Nvidia GPU is not available, run:
@84adam
84adam / password-entropy.sh
Created October 24, 2024 13:12
Password Entropy Calculator: Go + WASM (Debian/x86) -- Bash Deployment Script
#!/bin/bash
# Exit on any error
set -e
echo "🚀 Starting Password Entropy Calculator setup..."
# Create project structure
PROJECT_DIR="password-entropy-calc"
mkdir -p $PROJECT_DIR/{cmd/server,wasm,static}
@84adam
84adam / go-wasm-hello-world.sh
Created October 23, 2024 19:41
Go WASM Hello World - Debian/x86
#!/bin/bash
# Exit on any error
set -e
echo "🚀 Starting Go WASM Hello World setup..."
# Check if Go is installed, if not install it
if ! command -v go &> /dev/null; then
echo "📦 Installing Go..."
@84adam
84adam / check-namespaces.sh
Created June 4, 2024 13:53
check namespaces plus associated processes and users
#!/bin/bash
echo "Listing processes and their associated user namespaces:"
for pid in $(ls /proc | grep '^[0-9]*$'); do
if [ -e /proc/$pid/ns/user ]; then
# Get the process command line
cmdline=$(cat /proc/$pid/cmdline | tr '\0' ' ')
# Get the process owner
@84adam
84adam / bash_c_example.sh
Created May 9, 2024 17:12
Bash-C Hello World: Compile and run a C program from a single Bash script
#!/bin/bash
# bash_c_example.sh
# Directory to store the C source file and the executable
EXAMPLES_DIR="$HOME/bash_c_examples"
# Ensure the directory exists, create it if not
mkdir -p "$EXAMPLES_DIR"
# Check if hello_world.c and hello_world executable already exist
@84adam
84adam / bcrypt-argon2-pbkdf2-hash-test.py
Last active May 7, 2024 14:24
bcrypt/argon2/pbkdf2 hash test -- target a work factor that requires at least 250 ms to compute
# bcrypt-argon2-pbkdf2-hash-test.py
import threading
import bcrypt
from pwdlib.hashers import argon2
from pwdlib import PasswordHash
from pwdlib.hashers.argon2 import Argon2Hasher
from hashlib import pbkdf2_hmac
import time
import psutil
@84adam
84adam / lnd-postgres-kv-decoder.py
Created February 23, 2023 04:58
Decode Keys/Values from Postgres LND Database
# lnd-postgres-kv-decoder.py
from decouple import config
import psycopg2
import psycopg2.extras
import pandas as pd
import time
tables = ['channeldb_kv', 'decayedlogdb_kv', 'macaroondb_kv',
'towerclientdb_kv', 'towerserverdb_kv', 'walletdb_kv']
@84adam
84adam / postgres-separators.txt
Created January 4, 2023 21:27
PostgreSQL: format multiple columns into string for each row using a semicolon as separator between fields
### PostgreSQL: format multiple columns into string for each row using a semicolon as separator between fields
```
SELECT
FORMAT('%s; %s; %s; %s',
col_one, col_two, col_three, col_four)
AS entries
FROM table_name;
```