Skip to content

Instantly share code, notes, and snippets.

@jt-nti
jt-nti / layout.js
Created April 16, 2024 20:41
Experimental Bangle.js layout for Heart Rate Monitor app
// Some data to graph
var data = new Array(16);
data.fill(0);
// Our custom renderer that draws a graph inside the layout
function renderGraph(l) {
require("graph").drawBar(g, data, {
miny: 0,
axes : true,
x:l.x, y:l.y, width:l.w, height:l.h
@jt-nti
jt-nti / microfabtastic.sh
Last active November 2, 2023 17:39
From zero to fabric network with minimum effort
#!/usr/bin/env sh
set -euxo pipefail
go install github.com/hyperledger-labs/microfab/cmd/microfab@latest
mkdir -p microfab-test
pushd microfab-test
mkdir -p chaincode
@jt-nti
jt-nti / cloud-init.cfg
Created October 7, 2022 14:54
Just trying out cloud-init
#cloud-config
runcmd:
# Note: Don't write files to /tmp from cloud-init use /run/somedir instead.
# Early boot environments can race systemd-tmpfiles-clean LP: #1707222.
- mkdir /run/cloudftw
- echo hello > /run/cloudftw/cloudftw.txt
@jt-nti
jt-nti / init-cheerlights.sh
Last active June 26, 2022 17:59
Oracle cloud-init script for LaMetric Cheerlights server
#!/bin/sh
# Attempt to start up the lametric cheerlights server on a free Oracle compute VM
sudo apt-get -yq update
sudo apt-get -yq upgrade
sudo apt-get -yq remove docker docker-engine docker.io containerd runc || true
sudo apt-get -yq install \
apt-transport-https \
@jt-nti
jt-nti / nginx-gist.sh
Created November 18, 2020 17:51
Extract nginx config file from docker image
docker create --name nginx nginx
docker cp nginx:/etc/nginx/nginx.conf ./nginx.conf
docker rm -f nginx
@jt-nti
jt-nti / gist:b7acd8a7d77ee0534a9e50d5df9fbf4c
Created January 24, 2020 14:37
JSONata expression to convert azure pipeline status to lametric DIY app format. Example source data https://dev.azure.com/Hyperledger/Fabric-Chaincode-Java/_apis/build/metrics/daily?branchName=master
{
"frames" : [
{
"text": "fabric-chaincode-java"
},
{
"chartData": $reverse([value[name='FailedBuilds'].intValue])
}
]
}
@jt-nti
jt-nti / gist:022f938ecec939a2d7a502ebef457756
Created January 24, 2020 14:36
JSONata expression to convert azure pipeline status to lametric DIY app format
{
"frames" : [
{
"text": "fabric-chaincode-java"
},
{
"chartData": $reverse([value[name='FailedBuilds'].intValue])
}
]
}
@jt-nti
jt-nti / collections_config.json
Last active July 25, 2019 08:56
Hyperledger Fabric private data collection definition. See issue FAB-1311 - https://jira.hyperledger.org/browse/FABN-1311
[
{
"name": "underHat",
"policy": {
"identities": [
{
"role": {
"name": "member",
"mspId": "Org1MSP"
}
@jt-nti
jt-nti / chaincode-init.gradle
Last active July 23, 2020 18:48
Hackety hack to publish jars to a directory inside a Hyperledger Fabric smart contract
/*
* This gradle init script can be used to publish jars to a repository folder
* inside a Fabric contract project. For example, in the `fabric-chaincode-java` project:
*
* ./gradlew -I ~/chaincode-init.gradle -PchaincodeRepoDir=<chaincode_dir>/repository publishShimJarPublicationToFabricRepository publishProtosJarPublicationToFabricRepository
*
* Where <chaincode_dir> is the chaincode location containing your contract!
*
* Fabric contract projects can then use jars from the bundled maven repository
* during the Fabric instantiation process by adding the following repository
@jt-nti
jt-nti / docker-compose.yml
Created April 26, 2019 10:11
Quick and dirty hack to host a local maven repository which messing about with Fabric Java chaincode. Didn't actually work but the nginx image seems useful for future hacking!
version: '2'
networks:
maven:
services:
maven:
container_name: maven
image: nginx
ports: