Skip to content

Instantly share code, notes, and snippets.

domob1812 /
Created Aug 26, 2019
Test code for SQLite session extension and UNIQUE constraints
#!/bin/sh -e
PKGS="sqlite3 libglog"
CFLAGS="`pkg-config --cflags ${PKGS}` -std=c++14 -Wall -Werror -pedantic"
CFLAGS="${CFLAGS} -std=c++14 -Wall -Werror -pedantic"
LIBS=`pkg-config --libs ${PKGS}`
g++ ${CFLAGS} ${LIBS} test.cpp -o test
domob1812 /
Last active Aug 15, 2019
libjson-rpc-cpp threading deadlock
#!/bin/sh -e
jsonrpcstub test.json --cpp-client=TestRpcClient --cpp-client-file=client.h
jsonrpcstub test.json --cpp-server=TestServerStub --cpp-server-file=serverstub.h
PKGS="libjsonrpccpp-client libjsonrpccpp-server libglog"
CFLAGS="`pkg-config --cflags ${PKGS}` -std=c++14 -Wall -Wextra -Werror"
LIBS="-L/usr/local/lib `pkg-config --libs ${PKGS}` -lpthread"
g++ -g -O0 -o client client.cpp ${CFLAGS} ${LIBS}
domob1812 / sqlite_session_test.cpp
Created Jan 6, 2019
SQLite session fails with "WITHOUT ROWID" and "INSERT OR REPLACE"
View sqlite_session_test.cpp
#include <sqlite3.h>
#include <glog/logging.h>
#include <cstdlib>
#include <iostream>
printResults (void*, int numColumns, char** values, char** columns)
domob1812 /
Last active Nov 23, 2018
Tests Xaya Core with very large batch RPC requests
#!/usr/bin/env python3
# Test for
# Should be run from within Xaya's test/functional directory.
from test_framework.util import str_to_b64str
import http.client
import json
import urllib.parse
domob1812 /
Created Aug 30, 2018
Provably-fair selection "k out of n"
#!/usr/bin/env python3
# This script computes an ordered list of k random integers from the range
# [1, n] (both inclusive). This is done in a provably fair way based on
# some hex seed (may be a Bitcoin block hash, for instance).
import codecs
import hashlib
import math
import struct
domob1812 /
Created Aug 6, 2018
Example Python script for Xaya wallet interactions
# This is available in "python-jsonrpclib" on Debian/Ubuntu systems.
import jsonrpclib
import json
# Set according to your xaya.conf or the authentication cookie. Change port
# to 18396 for testnet and to 18493 for regtest.
user = "..."
You can’t perform that action at this time.