Skip to content

Instantly share code, notes, and snippets.

View WietseWind's full-sized avatar
⌨️
Focusing

Wietse Wind WietseWind

⌨️
Focusing
View GitHub Profile
@WietseWind
WietseWind / sh.bash
Created March 1, 2025 22:38
Proxmox: force exit cluster & re-join
# NOTE!! DO THIS ONE BY ONE, IT FAILS IF TWO NODES TRY TO JOIN AT THE SAME TIME!
# Clear join (back to standalone)
systemctl stop pve-cluster corosync
pmxcfs -l
rm /etc/corosync/*
rm /etc/pve/corosync.conf
killall pmxcfs
systemctl start pve-cluster
@WietseWind
WietseWind / main.java
Created February 23, 2025 01:49
CRC16 / CRC-A implementation of ISO 14443-3 in Java
// Eg run @ https://www.programiz.com/java-programming/online-compiler/
// data: 48 65 6C 6C 6F 20 57 6F 72 6C 64
// CRC-16: 52 7B
class Main {
public static byte[] calculateCRC16(byte[] bytes) {
byte chBlock;
int wCRC = 0x6363;
int i = 0;
@WietseWind
WietseWind / receipient.sh
Created December 19, 2024 14:49
UDP fragmentation checker
#!/bin/bash
PORT=12345
RESULTS_DIR="udp_receiver_results_$(date +%Y%m%d_%H%M%S)"
mkdir -p "$RESULTS_DIR"
echo "Starting UDP fragmentation test - Receiver"
echo "----------------------------------------"
echo "Port: $PORT"
echo "Results directory: $RESULTS_DIR"
@WietseWind
WietseWind / dlvr.sh
Last active January 2, 2025 11:32
DLVR.CLOUD one file upload bash script
#!/bin/bash
# Install
# sudo curl https://gist.githubusercontent.com/WietseWind/5ef71f7a26d9588a233f1d034762ac84/raw/dlvr.sh > /usr/local/bin/dlvr
# sudo chmod +x /usr/local/bin/dlvr
# Use: dlvr somefilename
DLVR_INIT=$(curl -i -s https://dlvr.cloud/api.php)
DLVR_SESSION=$(echo "$DLVR_INIT"|grep session|grep addr|grep domain|jq .session|cut -d '"' -f 2)
DLVR_ADDR=$(echo "$DLVR_INIT"|grep session|grep addr|grep domain|jq .addr|cut -d '"' -f 2)
@WietseWind
WietseWind / coolify-custom.md
Last active November 7, 2024 03:13
Coolify Tips
  • Install the Git webhook for Push to Deploy
  • Custom headers (!!) NEEDS [ ] STATIC to be DISABLED even if static, example: https://github.com/WietseWind/iPubXahau-Homepage
    • Make sure you have the nixpacks.toml and the .nix folder, the custom headers (nginx format) are in the .nix folder.
@WietseWind
WietseWind / index.mjs
Created September 18, 2024 10:40
Create Escrow in incrementing instalments
import fetch from 'node-fetch'
import { XrplDefinitions, derive, sign } from 'xrpl-accountlib'
const now = new Date()
const Server = 'https://xahau-test.net' // can be testnet, xahau-test.net / xahau.network
const secret = '{sender secret}' // can be RK secret
const Account = derive.familySeed(secret)
Account.address = '{sender account r-address}'
@WietseWind
WietseWind / prtg.js
Created August 2, 2024 00:07
Shelly 1 PM Mini Gen 3 - PRTG
// Access: http://{ip}/script/1/prtg
HTTPServer.registerEndpoint('prtg', function (request, response) {
response.headers = [
['content-type', 'application/json']
]
const em = Shelly.getComponentStatus('switch', 0)
const ip = Shelly.getComponentStatus('input', 0)
@WietseWind
WietseWind / prtg.js
Last active July 8, 2024 08:53
PRTG formatted JSON endpoint for "HTTP Data Advanced" sensor straight from Shelly
// Shelly: Scripts - create prtg.js with contents below - Start - Scripts main page: "Run on start"
// Call with (assuming the first script): http://{shellyip}/script/1/prtg
// PRTG: Import HTTP Data Advanced sensor.
HTTPServer.registerEndpoint('prtg', function (request, response) {
response.headers = [
['content-type', 'application/json']
]
const em = Shelly.getComponentStatus('em', 0)
@WietseWind
WietseWind / index.mjs
Created June 20, 2024 14:26
Calculate Balance Adjustment on Xahau
import fetch from 'node-fetch'
import { hookStateXLFtoBigNumber } from './xfl.mjs'
// Credits: https://github.com/tequdev/xahau-reward-claim/blob/main/src/app/ClaimReward.tsx
const account = 'rTeLeproT3BVgjWoYrDYpKbBLXPaVMkge'
const RPC_ENDPOINT = 'https://xahau.network'
const toUnixTimestamp = ts => ts + 946684800
@WietseWind
WietseWind / state.mjs
Created June 20, 2024 10:54
Xahau Voucher state
import { getPubKey, xflHexToString } from "./statelib.mjs";
const main = async () => {
console.log(getPubKey(process.argv[2]));
const options = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({