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 / readme.md
Created July 20, 2023 22:12
Get IPv6 client DUID from EdgeOS dhcpv6 Lease
  1. Find client: cat /run/dhcpdv6.leases
  2. Get ia-na value.

If not starting with \000\000\000, slicing required.

Python script to turn DUID into needed format:

import binascii

# Replace the string below with your IA_NA data
@WietseWind
WietseWind / b2m.mjs
Last active February 11, 2025 16:46
Simple B2M with hosted xPOP
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
console.log('Obtaining XRPL Testnet account (faucet)')
@WietseWind
WietseWind / index.mjs
Created June 19, 2023 18:30
Custom Definitions with XRPL Accountlib
const { XrplClient } = require('xrpl-client')
const { sign, derive, XrplDefinitions } = require('xrpl-accountlib')
const client = new XrplClient('wss://hooks-testnet-v3.xrpl-labs.com')
const account = derive.familySeed("s....")
const liveDefinitions = await client.send({ command: 'server_definitions' })
const definitions = new XrplDefinitions(liveDefinitions)
@WietseWind
WietseWind / sample.html
Created June 17, 2023 23:05
Xumm Universal SDK: get rates after valid session - Sample: https://duprtep.dlvr.cloud/index.html
<html lang="en">
<body>
<h1 id="accountaddress">Account...</h1>
<pre id="rates">Rates...</pre>
<button id="signinbutton" onclick="xumm.authorize()">Login</button>
<script src="https://xumm.app/assets/cdn/xumm.min.js"></script>
<script>
@WietseWind
WietseWind / xrpl-client-accountlib.js
Created June 15, 2023 14:39
Dynamic network definitions
const { XrplClient } = require('xrpl-client')
const { sign, derive, XrplDefinitions } = require('xrpl-accountlib')
const client = new XrplClient('wss://hooks-testnet-v3.xrpl-labs.com')
const account = derive.familySeed("xxxxxx")
;(async () => {
const liveDefinitions = await client.send({ command: 'server_definitions' })
const definitions = new XrplDefinitions(liveDefinitions)
@WietseWind
WietseWind / profile.js
Created May 12, 2023 21:49
Auth0 fetch user profile script
function fetchUserProfile(accessToken, context, callback) {
request.get(
{
url: 'https://oauth2.xumm.app/userinfo',
headers: {
'Authorization': 'Bearer ' + accessToken,
}
},
(err, resp, body) => {
if (err) {
@WietseWind
WietseWind / paychan.json
Last active July 20, 2023 13:14
PayChan in Xumm
// Creating the channel
{
"txjson": {
"TransactionType": "PaymentChannelCreate",
"Amount": "1000000",
"Destination": "rfHn6cB5mmqZ6fHZ4fdemCDSxqLTijgMwo",
"PublicKey": "037E3F11237DF2E0EBFE3B5872A5BB76F1C05DE079BA44E157E7896F0AFC7F7BE8", // Only needed if not the signer
"SettleDelay": 1
}
}
@WietseWind
WietseWind / convert.js
Last active May 5, 2023 12:24
Hex <> Number <> UTF-8 in Node
// Uint32 max: 4294967295
// 1500474479
console.log(
parseInt(Buffer.from('Yolo', 'utf-8').toString('hex'), 16)
)
console.log(
Buffer.from(Number(1500474479).toString(16), 'hex').toString('utf-8')
)
@WietseWind
WietseWind / erconfig.txt
Created May 2, 2023 13:23
PBR Different Route @ ER (Policy Based Routing)
# Modify route
set protocols static table 10 route 0.0.0.0/0 next-hop 10.200.0.113
set firewall modify PBR rule 20 description LAN1
set firewall modify PBR rule 20 source address 10.150.5.0/24
set firewall modify PBR rule 20 modify table 10
set firewall modify PBR rule 30 description LAN2
set firewall modify PBR rule 30 source address 10.50.5.0/24
@WietseWind
WietseWind / snmp.js
Created April 27, 2023 20:28
SNMP APC Netbotz 200 - Get temp & Switch Relay with NodeJS
var snmp = require ("net-snmp");
var session = snmp.createSession("10.2.1.151", "private")
const relayOid = '1.3.6.1.4.1.318.1.1.10.4.4.4.1.5.0.1'
const outletOid = '1.3.6.1.4.1.318.1.1.10.4.5.4.1.5.0.1'
var oids = [
"1.3.6.1.4.1.318.1.1.10.4.2.3.1.5.0.1", // temp 1
"1.3.6.1.4.1.318.1.1.10.4.2.3.1.5.0.4", // temp 4