Skip to content

Instantly share code, notes, and snippets.

💭
https://developer.bitcoin.com is where I play.

Chris Troutner christroutner

💭
https://developer.bitcoin.com is where I play.
Block or report user

Report or block christroutner

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
@christroutner
christroutner / AD-README.md
Created Mar 15, 2020
Raspberry Pi A/D Board
View AD-README.md

This is the README that was included with the software I got when purchasing this A/D board for my RPi: https://amzn.to/2IQ8BSU

RaspberryPi-ADC-DAC

Codes to perform Analog to Digital(ADC, using ADS1256 circuit) and Digital to Analog (DAC, using DAC8552) based on Raspberry PI extended with Waveshare High-Precision AD-DA raspberry pi hat/shield.

The provided codes with the hat/shield was not satisfying (IMHO). These codes are cleaner, faster and meant to be used in other projects (as you have a lib AD-DA-WS-RPI with proper CMakeLists and Find.cmake to compile it).

Installation

View insight-vs-ninsight.md

Insight vs Ninsight Comparison

This document captures the differences between Insight and Ninsight BCH indexers for the most commonly used endpoints on rest.bitcoin.com.

This BCH address is used for comparison:

  • bitcoincash:qqyqtcjddlvvyxmdaszprmyqdaxnef7zwc7uap46nj

The test results below are from running rest.bitcoin.com locally, but pointing at Insight in one case, and then pointing at Ninsight in the other case.

@christroutner
christroutner / ipfs.service
Created Jan 25, 2020 — forked from MaxLaumeister/ipfs.service
systemd script for ipfs-daemon run-on-boot
View ipfs.service
[Unit]
Description=IPFS daemon
After=network.target
[Service]
### Uncomment the following line for custom ipfs datastore location
# Environment=IPFS_PATH=/path/to/your/ipfs/datastore
ExecStart=/usr/local/bin/ipfs daemon
Restart=on-failure
@christroutner
christroutner / js-function-layout.js
Last active Jan 4, 2020
Standard JavaScript Function Layout
View js-function-layout.js
/*
This gist captures the basic pattern of a JavaScript function. It emcompasses patterns for best practices.
*/
// This global is used to reference the library instance when the 'this' context has been lost.
let _this
// With the switch to Classes for instantiating JS libraries, this is a common pattern:
// Note: An object starting with a capital letter denotes a Class: e.g. SomeExternalLibrary
const SomeExternalLibrary = require('./someExternalLibrary')
@christroutner
christroutner / p-queue-retry.js
Last active Dec 23, 2019
Promise queue and auto-retry example
View p-queue-retry.js
/*
Tests the promise queue (p-queue) and promise retry (p-retry) libraries.
*/
"use strict";
const { default: PQueue } = require("p-queue");
const queue = new PQueue({ concurrency: 1 });
const pRetry = new require("p-retry");
@christroutner
christroutner / bch-retry.js
Last active Dec 22, 2019
p-retry BCH transactions
View bch-retry.js
/*
This is a snippet of a bigget program that I wrote. The code in this file is not stand-alone.
It captures the code used to generate BCH transactions with auto-retry, so that the software
keeps trying to send the transaction if it runs into issues.
It's a good example of how to use the p-retry npm library for auto-retrying promise-based
functions.
*/
@christroutner
christroutner / README.md
Created Oct 24, 2019
Testing rate limits for my fork for slpserve
View README.md

This gist is a test for the rate limits on my fork of slpserve with the feature branch to put rate limits and Basic Authentication in place.

The test is forked from this rate-limit test gist.

In my fork, the public rate limits is set to 3 requests per minute (RPM). And a high number (10,000) RPM if a Basic Authentication header is included. By default the login/password for basic authentication is BITBOX/BITBOX, but the password can be changed by setting the PRO_PASS environment variable.

View README.md

This is a JSON file containing an array of just under 900 TXIDs. Each TXID is a BCH transaction that is a valid SLP token transaction.

View jwt-token-demo.js
/*
A demo of using a JWT token to access a REST API.
*/
const axios = require("axios");
async function runTest() {
try {
for (let i = 0; i < 60; i++) {
const success = await getNetworkInfo();
@christroutner
christroutner / ipfs.service
Created Oct 10, 2019 — forked from lordcirth/ipfs.service
IPFS systemd service with resource limits
View ipfs.service
[Unit]
Description=IPFS daemon
After=network-online.target
[Service]
ExecStart=/home/ipfs/.nix-profile/bin/ipfs daemon
User=ipfs
LimitNice=10
MemoryHigh=4G
# OOM-killer
You can’t perform that action at this time.