Skip to content

Instantly share code, notes, and snippets.

Wietse Wind WietseWind

View GitHub Profile
@WietseWind
WietseWind / pub.js
Last active Apr 9, 2019
Redis + Node PubSub vs. Task Publisher / Task Runner
View pub.js
// PubSub example, check pub.js and sub.js
// This is the publising of messages
// Messages will only be seen by subscribers that are already listening
// Credits: https://thisdavej.com/guides/redis-node/node/pubsub.html
const Redis = require('ioredis')
const pub = new Redis()
const channel = 'mychannel:123'
console.log('Started publisher...')
@WietseWind
WietseWind / query.sql
Created Mar 27, 2019
XRPL BigQuery: Find activation date for Account
View query.sql
SELECT
CloseTimeHuman
FROM
xrpledgerdata.fullhistory.ledgers
WHERE
LedgerIndex = (
SELECT
LedgerIndex
FROM
xrpledgerdata.fullhistory.transactions
@WietseWind
WietseWind / memo.js
Created Mar 18, 2019
XRPL Payment with Memo
View memo.js
const RippledWsClient = require('rippled-ws-client')
const RippledWsClientSign = require('rippled-ws-client-sign')
const SeedOrKeypair = 'sZZZZZZZZZ' // The secret of the sending wallet
const Transaction = {
TransactionType: 'Payment',
Account: 'rXXXXX',
Destination: 'rYYYYYYY',
Amount: 4635000000,
@WietseWind
WietseWind / label-color.js
Created Mar 8, 2019
Generate Meetup labels
View label-color.js
const username = process.argv[2]
const type = process.argv[3] || 1
const sharp = require('sharp')
const QRCode = require('qrcode')
const fetch = require('node-fetch')
const printer = require("node-printer-lp-complete")
const printOptions = {
media: 'Custom.25x50mm',
destination: "ColorLabelPrinter",
View index.js
const elliptic = require('elliptic')
const secp256k1 = elliptic.ec('secp256k1')
const hash = require('hash.js')
const keypairs = require('ripple-keypairs')
const hexToDecimal = (x) => secp256k1.keyFromPrivate(x, 'hex').getPrivate().toString(10)
module.exports = {
sign (message, familySeed) {
const digest = hash.sha256().update(message).digest('hex').toUpperCase()
@WietseWind
WietseWind / child.js
Created Feb 15, 2019
NodeJS parent/child communication (fork) -- Ugly & basic
View child.js
let parentId
process.on('message', (msg) => {
if (typeof msg.parentId !== 'undefined') parentId = msg.parentId
console.log(`[CHILD_${parentId}] » Message from parent`, msg)
})
let counter = 0
let interval = setInterval(() => {
@WietseWind
WietseWind / iou-payments.md
Last active Apr 3, 2019
XRPL IOU Payments
View iou-payments.md

DEX

Send EUR to XRP (the other way around) to another account with sell offer)

DEX

{
	"TransactionType": "TrustSet",
	"Account": "rpePPeRpC89vpCY3CDzhzMCs78nPoNnAKm",
	"Fee": "12",
View coil.js
<script src="https://polyfill.webmonetization.org/polyfill.js"></script>
<script src="https://cdn.coil.com/donate.js"></script>
<script>
window.WebMonetizationScripts.donate({
paymentPointer: '$twitter.xrptipbot.com/WietseWind'
})
</script>
@WietseWind
WietseWind / XRPL-IOU.md
Last active Dec 13, 2018
IOU issue on the XRP ledger
View XRPL-IOU.md

IOU

OPTIONAL:

  • TickSize
  • No Freeze
  • No XRP
  1. Set issuer account flag 8, DefaultRipple (so people can send to each other) - When people set trustlines incoming to the issuer) NoRipple may be set, but the issuer needs to ripple TO other users.
@WietseWind
WietseWind / activating_tx.sql
Created Dec 6, 2018
BigQuery Account Stats
View activating_tx.sql
SELECT
Account,
LedgerIndex,
TransactionIndex,
`hash`,
TransactionType,
AmountXRP
FROM xrpledgerdata.fullhistory.transactions
WHERE
TransactionResult = 'tesSUCCESS'
You can’t perform that action at this time.