Skip to content

Instantly share code, notes, and snippets.

View braydonf's full-sized avatar

Braydon Fuller braydonf

View GitHub Profile
@braydonf
braydonf / tokenminer.js
Created August 17, 2017 03:28
Example script to do basic proof-of-work
#!/usr/bin/env node
'use strict';
//node pow.js '{"challenge": "f8b55e92d345bae0e644419982c2fadcf003289ac3ed638a5651e77ba24d4f5c", "target": "00000560a5e9cfe18772cc5cf6c5e29dc79d118ebcfc5ee72a2d56aff20c0fc6"}'
const web3 = require('web3');
const data = JSON.parse(process.argv[2]);
const challenge = '0x' + data.challenge;
const target = '0x' + data.target;
let nonce = 0;
@braydonf
braydonf / allocate-file-test.c
Last active April 11, 2017 05:34
allocate file test
#define _GNU_SOURCE
#ifdef _WIN32
#include <windows.h>
#endif
#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
@braydonf
braydonf / memory-mapped-test.c
Last active April 11, 2017 09:32
testing memory mapped files
#include <stdio.h>
#include <errno.h>
#include <stdint.h>
#ifdef _WIN32
#include <windows.h>
#include <io.h>
#else
#include <sys/mman.h>
#endif
@braydonf
braydonf / bench-redis-memcached-mongodb.js
Last active April 5, 2017 22:18
bench-redis-memcached-mongodb.js
/*
"dependencies": {
"benchmark": "^2.1.4",
"memcached": "^2.2.2",
"mongodb-core": "^2.1.9",
"redis": "^2.7.1"
}
*/
const redis = require('redis');
From f9e4e11063bb7ddda4c05c061e1f8b4ee29a1be4 Mon Sep 17 00:00:00 2001
From: Braydon Fuller <[email protected]>
Date: Sun, 5 Feb 2017 01:20:23 -0500
Subject: [PATCH] tests with mingw
---
tests/test1.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tests/test1.c b/tests/test1.c
---
configure.ac | 2 +-
tests/run_wine.bash | 5 +++++
tests/strerror_override.c | 3 +++
tests/test1.c | 2 +-
tests/test_util_file.c | 10 ++++------
5 files changed, 14 insertions(+), 8 deletions(-)
create mode 100755 tests/run_wine.bash
diff --git a/configure.ac b/configure.ac
@braydonf
braydonf / uv_cancel_example.c
Last active February 6, 2020 16:09
libuv example for cancelling queued work
// An implementation of what is decribed at:
// https://nikhilm.github.io/uvbook/threads.html#id1
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <uv.h>
@braydonf
braydonf / libnettle-aes-256-ctr.c
Last active June 25, 2019 01:28
libnettle aes 256 ctr example encrypt/decrypt
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <nettle/aes.h>
#include <nettle/ctr.h>
int main() {
struct aes256_ctx *ctx = malloc(sizeof(struct aes256_ctx));
@braydonf
braydonf / lmdb-test.js
Last active September 28, 2016 16:41
lmdb-test.js
describe('Cursors (utf16 string key and binary value)', function() {
this.timeout(10000);
var env;
var dbi;
var total = 10;
before(function() {
env = new lmdb.Env();
env.open({
path: testDirPath,
maxDbs: maxDbs,
@braydonf
braydonf / bitcoin-uri-handling.md
Created April 27, 2016 02:25
setting up bitcoin handling for local bitcoin install
[Desktop Entry]
Type=Application
Name=Bitcoin-QT
GenericName=Bitcoin Client
Comment=Bitcoin wallet
Categories=Qt;Network;
Exec=/usr/local/bin/bitcoin-qt %u
Icon=bitcoinicon
StartupNotify=false