Skip to content

Instantly share code, notes, and snippets.

Avatar
⌨️
Focusing

Wietse Wind WietseWind

⌨️
Focusing
View GitHub Profile
@WietseWind
WietseWind / index.mjs
Last active Jan 29, 2023
Update electric-capital/crypto-ecosystems with up to date XRPL repos
View index.mjs
import fetch from 'node-fetch'
const repos = []
const knownRepoCall = await fetch('https://raw.githubusercontent.com/electric-capital/crypto-ecosystems/master/data/ecosystems/x/xrp.toml')
const knownRepoData = await knownRepoCall.text()
for (let page = 1; page < 10; page++) {
const call = await fetch('https://api.github.com/search/repositories?q=xrp+xrpl&order=desc&per_page=1000&page=' + page)
const json = await call.json()
@WietseWind
WietseWind / payment.mermaid
Last active Dec 11, 2022
Sequence: Xumm POS Payment
View payment.mermaid
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@WietseWind
WietseWind / banxa-api-signature.mjs
Created Sep 29, 2022
Banxa API from NodeJS (signature)
View banxa-api-signature.mjs
import fetch from 'node-fetch'
import {createHmac} from 'crypto'
const endpoint = 'xxxxxx
const key = 'yyyyyy'
const secret = 'xxxxxxxx'
const banxaCall = async (path, body, method = 'GET') => {
const nonce = Math.round(new Date() / 1000)
@WietseWind
WietseWind / setup.sh
Last active Sep 7, 2022
xrpld monitor
View setup.sh
echo 'Install xrpld monitoring'
echo ''
echo 'Please provide some info, if you need to change this, you can do so later in /etc/crontab'
echo ''
echo 'Local host + port with xrpld websocket, e.g. "localhost:6006"'
read host
echo ''
@WietseWind
WietseWind / animated-gif-for-tydbit.mjs
Created Aug 27, 2022
Animated GIF based on multiple SVG frames (sharpjs) for Tydbit (in NodeJS)
View animated-gif-for-tydbit.mjs
import express from 'express'
import sharp from 'sharp'
import fetch from 'node-fetch'
import { Gif } from 'make-a-gif'
sharp.cache(false)
const app = express()
const port = 3000
@WietseWind
WietseWind / svg-to-gif-for-tydbit.mjs
Last active Aug 27, 2022
Tidbyt SVG to GIF with NodeJS
View svg-to-gif-for-tydbit.mjs
import express from 'express'
import sharp from 'sharp'
import fetch from 'node-fetch'
sharp.cache(false)
const app = express()
const port = 3000
const device = 'some-device-name-whatever-123'
@WietseWind
WietseWind / index.mjs
Last active Jul 4, 2022
Fun with Generator Functions. First backfill XRPL Ledgers, then keep up with current Ledgers closing, fall back to backfilling if needed to sync gaps.
View index.mjs
import { XrplClient } from 'xrpl-client'
const config = { backfillLedgers: 20, lastLedger: null }
const client = new XrplClient(['wss://xrplcluster.com'])
await client.ready()
config.lastLedger = client.getState().ledger.last - config.backfillLedgers
function getLedgerTransactions(ledger_index) {
return client.send({ command: 'ledger', transactions: true, expand: true, ledger_index })
@WietseWind
WietseWind / user-profile-script.js
Last active Jun 20, 2022
Xumm OAuth2 Sign In for Auth0, based on Developer Question: https://xumm.readme.io/discuss/62af82ada6faf1007c0e89f3
View user-profile-script.js
function(accessToken, ctx, callback) {
const url = "https://oauth2.xumm.app/userinfo";
request.get(
{ url, headers: { 'Authorization': 'Bearer ' + accessToken, } },
(err, resp, body) => {
if (err) {
return callback(err);
}
if (resp.statusCode !== 200) {
@WietseWind
WietseWind / pkce-implicit.html
Created May 26, 2022
Example OAuth2 client side (vanillaJS) example with Implicit PKCE flow
View pkce-implicit.html
<html>
<title>OAuth Authorization Code + PKCE in Vanilla JS</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!-- Credits: https://github.com/aaronpk/pkce-vanilla-js/blob/master/index.html -->
<script>
// Configure your application and authorization server details
var config = {
client_id: "<The Xumm App API key (public)>",
@WietseWind
WietseWind / build.sh
Created Apr 14, 2022
Hooks AssemblyScript V2
View build.sh
#!/bin/bash
rm ./module.wasm
rm ./module.wat
node assemblyscript/bin/asc \
-O3 \
--noAssert \
--runtime minimal \
--textFile ./module.wat \