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 / patch.sh
Last active May 10, 2024 14:50
Detect CVE-2024-2961 and mitigage (tested: Ubuntu & Debian & Proxmox hosts) - Host / Docker containers
#!/bin/bash
# Detect CVE-2024-2961 and mitigage (tested: Ubuntu & Debian & Proxmox hosts)
# Wietse Wind 10-05-2024
# Based on the idea from https://raw.githubusercontent.com/mattaperkins/FIX-CVE-2024-2961/main/fix.sh
# ^^ Changes I made: auto detect file (several files eligible instead of one) & create back up of patched file
# Finds the right file and patches
# Safely run again to verify patch
# Run on host:
# curl https://gist.githubusercontent.com/WietseWind/9fe2eda3fece426bf873a4aeb15c4267/raw/patch.sh | bash
@WietseWind
WietseWind / voucher-gen-claim.mjs
Last active April 2, 2024 13:38
Voucher generation & claim
import {
// generate,
derive
} from 'xrpl-accountlib'
import rippleAddressCodec from 'ripple-address-codec'
import {
sign,
verify
@WietseWind
WietseWind / update.sh
Last active April 24, 2024 17:31
Upate Xahaud node running xahaud natively (without Docker)
update=2024.4.21-release+858
cd /opt/xahaud/downloads/ && \
wget https://build.xahau.tech/"$update" && \
cd /opt/xahaud/bin && \
service xahaud stop && \
rm xahaud && \
ln -s ../downloads/$update ./xahaud && \
chmod +x ./xahaud && service xahaud start
@WietseWind
WietseWind / index.js
Created December 29, 2023 01:01
Run browserified cjs in NodeJS using sandbox vm (sample with `xrpl-accountlib`)
const fs = require('fs')
const vm = require('vm')
const sandbox = {}
// https://cdn.jsdelivr.net/npm/xrpl-accountlib/dist/browser.min.js
vm.runInNewContext(fs.readFileSync('browser.min.js'), sandbox)
var AccountLib = sandbox.require('xrpl-accountlib')
@WietseWind
WietseWind / list_one.xml
Created December 25, 2023 15:51
Xaman World Currencies Feed (live)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ISO_4217 Pblshd="October 1, 2021">
<CcyTbl>
<CcyNtry>
<CtryNm>AFGHANISTAN</CtryNm>
<CcyNm>Afghani</CcyNm>
<Ccy>AFN</Ccy>
<CcyNbr>971</CcyNbr>
<CcyMnrUnts>2</CcyMnrUnts>
</CcyNtry>
@WietseWind
WietseWind / update.sh
Last active April 24, 2024 02:28
Xahaud RPC Mainnet Node (in Docker) binary update
update=2023.12.29-release+689
container=$(docker ps -a |grep xahau|cut -d " " -f 1)
build=$(docker exec -it $container /opt/xahaud/bin/xahaud -q --version|rev|cut -d "+" -f 1|rev|sed 's/[^0-9]*//g')
docker exec -it $container sh -c "curl https://build.xahau.tech/$update > /opt/xahaud/bin/new"
docker exec -it $container chmod +x /opt/xahaud/bin/new
newbuild=$(docker exec -it $container /opt/xahaud/bin/new -q --version|rev|cut -d "+" -f 1|rev|sed 's/[^0-9]*//g')
if [[ "$newbuild" -lt "$build" ]]; then
echo "Not OK, $build gt $newbuild"
@WietseWind
WietseWind / generate20accounts.mjs
Last active October 31, 2023 14:06
Send TX on Xahau mainnet
import { generate, utils, signAndSubmit } from 'xrpl-accountlib'
for (let i = 0; i < 20; i++) {
const account = generate.familySeed({ algorithm: 'ed25519' })
console.log(`${account.address}\t${account.secret.familySeed}\t${account.keypair.privateKey}`)
}
@WietseWind
WietseWind / b2m.mjs
Created October 30, 2023 23:50
B2M (Burn to Mint) XRPL Mainnet to Xahau Mainnet
import { derive, utils, signAndSubmit } from 'xrpl-accountlib'
import { TxData } from 'xrpl-txdata'
import { XrplClient } from 'xrpl-client'
import { xpop, setEndpoints as xpopEndpoints } from 'xpop'
import fetch from 'node-fetch'
// The above needs:
// npm install xrpl-accountlib xrpl-txdata xrpl-client xpop node-fetch
const account = derive.familySeed('s....secret')
@WietseWind
WietseWind / mint.mjs
Last active November 24, 2023 15:28
XLS20 NFToken ID calculation with fixNFTokenRemint compatibility
/// Based on: https://gist.github.com/N3TC4T/a20fb528931ed009ebdd708be4938748
import { derive, utils, signAndSubmit, } from "xrpl-accountlib"
import { XrplClient } from "xrpl-client"
import { decodeAccountID } from "ripple-address-codec"
import { TxData } from 'xrpl-txdata'
// const wss = [ 'wss://testnet.xrpl-labs.com', 'wss://s.altnet.rippletest.net:51233', ]
const wss = [ 'wss://s.devnet.rippletest.net:51233/' ]
const client = new XrplClient(wss)
@WietseWind
WietseWind / docker-ipv6-install.sh
Last active January 1, 2024 12:40
Ubuntu 22.04 with docker-ce in IPv6 only environment
# Assumptions:
# - Ubuntu 22.04
# - Docker CE
# - IPv6 only environment
# - Using netplan for IPv6 addressing
# - IPv6 /64 assigned to host
# - UFW in use (and DNS to be allowed) - otherwise skip the ufw config
# (The above is the Hetzner default)