Skip to content

Instantly share code, notes, and snippets.

Daniel Kraft domob1812

Block or report user

Report or block domob1812

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@domob1812
domob1812 / build.sh
Created Aug 26, 2019
Test code for SQLite session extension and UNIQUE constraints
View build.sh
#!/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"
CFLAGS="${CFLAGS} -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK"
LIBS=`pkg-config --libs ${PKGS}`
g++ ${CFLAGS} ${LIBS} test.cpp -o test
@domob1812
domob1812 / build.sh
Last active Aug 15, 2019
libjson-rpc-cpp threading deadlock
View build.sh
#!/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
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>
int
printResults (void*, int numColumns, char** values, char** columns)
{
@domob1812
domob1812 / batch_test.py
Last active Nov 23, 2018
Tests Xaya Core with very large batch RPC requests
View batch_test.py
#!/usr/bin/env python3
# Test for https://github.com/xaya/xaya/issues/72.
# 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
domob1812 / pickWinner.py
Created Aug 30, 2018
Provably-fair selection "k out of n"
View pickWinner.py
#!/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
domob1812 / xaya-wallet-example.py
Created Aug 6, 2018
Example Python script for Xaya wallet interactions
View xaya-wallet-example.py
#!/usr/bin/python
# 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.