Skip to content

Instantly share code, notes, and snippets.

@jt-nti
jt-nti / org.hyperledger.composer.system.AddAsset.txt
Last active June 16, 2018 17:17
Hyperledger Composer command line to add an asset: the power of system transactions!
composer transaction submit --card admin@basic-sample-network -d '{"$class": "org.hyperledger.composer.system.AddAsset", "targetRegistry": "resource:org.hyperledger.composer.system.AssetRegistry#org.example.basic.SampleAsset", "resources": [{"$class": "org.example.basic.SampleAsset", "assetId": "newAsset", "owner": "resource:org.example.basic.SampleParticipant#bob", "value": "101"}]}'
@jt-nti
jt-nti / dockergrp.sh
Created November 13, 2017 17:56
Ensure jenkins user has permission to access docker daemon socket
#!/bin/bash
if [ -e /var/run/docker.sock ]; then
DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)
else
exit 0
fi
if [ ${DOCKER_GID} ]; then
DOCKER_GROUP=$(getent group ${DOCKER_GID} | cut -d: -f1)
@jt-nti
jt-nti / serverless.md
Created May 16, 2018 14:09
Serverless reading list
@jt-nti
jt-nti / IBPnotes.md
Last active May 18, 2018 13:15
IBM Blockchain Platform notes
@jt-nti
jt-nti / composer-module-check.js
Last active June 1, 2018 14:19
Quick hack to check whether the Hyperledger Composer node modules got published, because npmjs
COMPOSER_MODULES=("composer-admin" \
"composer-rest-server" \
"composer-cli" \
"composer-runtime" \
"composer-client" \
"composer-runtime-embedded" \
"composer-common" \
"composer-runtime-hlfv1" \
"composer-connector-embedded" \
"composer-runtime-pouchdb" \
@jt-nti
jt-nti / pipeline.yml
Created June 11, 2018 10:05
Example pipeline.yml snippet for a Custom Docker Image type build job
# See https://console.bluemix.net/docs/services/ContinuousDelivery/toolchains_custom.html#toolchains_custom_pipeline_yml
# ...
jobs:
- name: Example
type: builder
artifact_dir: ''
build_type: customimage
docker_image: 'taylorjm/pipeline-job-composer0.19.5'
script: |-
#!/bin/bash
@jt-nti
jt-nti / get_deploy_name.sh
Created July 9, 2018 16:17
Experimental function to get a deploy name that's unlikely to collide on IBM Cloud
#!/bin/bash
function get_deploy_name {
uuid="$1"
shift
old_ifs="$IFS"
IFS='_'
name="$*"
IFS=$old_ifs
@jt-nti
jt-nti / retry.sh
Created August 7, 2018 12:55
Experimental function to retry a command with exponential backoff (based on https://stackoverflow.com/questions/8350942/how-to-re-run-the-curl-command-automatically-when-the-error-occurs discussion)
function retry_with_backoff {
local attempt=1
local max_attempts=5
local timeout=1
local exitCode=0
while : ; do
"$@"
exitCode=$?
@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:
@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