Skip to content

Instantly share code, notes, and snippets.

View Craigson's full-sized avatar

Craig Pickard Craigson

View GitHub Profile
@Craigson
Craigson / Dockerfilee
Last active January 8, 2021 14:40
The Publisher's Dockerfile for the Syntropy Stack MQTT Network example
FROM node:12
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
@Craigson
Craigson / docker-compose.yaml
Last active January 8, 2021 14:40
Docker compose file for the Publisher app in the Syntropy Stack MQTT network example
version: "2"
services:
syntropynet-agent:
image: syntropynet/agent:stable
hostname: syntropynet-agent
container_name: syntropynet-agent
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
@Craigson
Craigson / package.json
Created July 24, 2020 03:52 — forked from adamreisnz/package.json
Simple pure npm scripts build process
{
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "http://www.project-name.com",
"author": {
"name": "Adam Reis",
"url": "http://adam.reis.nz"
},
"license": "UNLICENSED",
@Craigson
Craigson / gist:b6f6692153639bb187d52c7f43f518b7
Created February 5, 2020 15:23
reactotron-react-hooks.js
export function plugin(reactotron) {
let _state = null;
const COMMAND_MAP = {
// When an "Action" occurs.
"state.action.complete": () => _state,
"state.backup.response": () => _state,
"state.values.subscribe": action => {
sendSubscriptions(_state);
}
@Craigson
Craigson / riskFormulas.js
Created September 17, 2019 19:26
Calculating CVD risk for patients
var Formula = function (appmodel){
var self= this;
var debug = false;
self.s010 = function() {
var i;
if (appmodel.Form().isAfrican() && appmodel.Form().isFemale()) i = 0.95334;
if (!appmodel.Form().isAfrican() && appmodel.Form().isFemale()) i = 0.96652;
if (appmodel.Form().isAfrican() && appmodel.Form().isMale()) i = 0.89536;
if (!appmodel.Form().isAfrican() && appmodel.Form().isMale()) i = 0.91436;
return i;
@Craigson
Craigson / download-progress.js
Created August 2, 2019 15:22
http download progress
var progress = require('progress-stream');
var fs = require('fs');
const http = require('http');
// const file = fs.createWriteStream('mov.mp4');
const request = http.get(
'http://10.0.1.177:8080/ccapi/ver100/contents/sd/100CANON/MVI_0656.MP4',
function(response) {
var stat = fs.statSync(filename);
var str = progress({
@Craigson
Craigson / wsClient.js
Created April 24, 2019 22:10
Update to wbbsocket client
const WebSocket = require('ws');
const maxApi = require('max-api');
const ws = new WebSocket('ws://localhost:7475');
const MAX_TAGS = 30;
const MIN_TAGS = 3;
const DELAY = 2000;
// const fromFile = require('./test.json')
// const { user } = fromFile

Keybase proof

I hereby claim:

  • I am craigson on github.
  • I am craigson (https://keybase.io/craigson) on keybase.
  • I have a public key ASAm7mbLa3CCDC0yhh2lpIrBdJbDXS92HIfUkVPlFBsW7wo

To claim this, I am signing this object:

@Craigson
Craigson / keybase_proof
Created December 12, 2017 17:03
Proving my KeyBase acc
### Keybase proof
I hereby claim:
* I am craigson on github.
* I am craigson (https://keybase.io/craigson) on keybase.
* I have a public key ASByau5sBml_ya4TBlBvGbsNDQiX1_690eoeKTGg9aZtKQo
To claim this, I am signing this object:
@Craigson
Craigson / gist:063475fbe5c95230998067610ec9d439
Created November 9, 2017 21:14
Verifying my Blockstack ID is secured with the address 1kzVHEBPuAvPJu58tKbYvAB5Mkew9Y4YK https://explorer.blockstack.org/address/1kzVHEBPuAvPJu58tKbYvAB5Mkew9Y4YK
Verifying my Blockstack ID is secured with the address 1kzVHEBPuAvPJu58tKbYvAB5Mkew9Y4YK https://explorer.blockstack.org/address/1kzVHEBPuAvPJu58tKbYvAB5Mkew9Y4YK