Instantly share code, notes, and snippets.

View jobqueue.js
const redis = require('redis');
const moment = require('moment');
class JobQueue {
constructor() {
this.config = null;
this.redisdb = null;
this.redisKey;
}
View message.js
async checkForTasks(callback) {
let message;
try {
message = await this.hydra.getQueuedMessage(this.serviceName);
} catch (e) {
this.logger('fatal', e);
return;
}
// message processing code lines deleted here...
View segment-transfer.js
async queueAggregatorJob(jobID, status, statusMessage) {
return hydra.queueMessage(hydra.createUMFMessage({
to: 'aggregator-svcs:/',
frm: 'segment-transfer-svcs',
typ: 'process',
bdy: {
jobID,
status,
statusMessage
}
View stackdn.sh
#!/bin/sh
export STACK_NAME='test'
docker stack rm ${STACK_NAME}
View stackup.sh
#!/bin/sh
export STACK_NAME='test'
mkdir -p ~/data/${STACK_NAME}/redis
echo "\nStarting core services"
sudo STACK_NAME=${STACK_NAME} docker stack deploy --compose-file compose.yml ${STACK_NAME}
View compose.yml
version: "3.4"
networks:
servicenet:
driver: overlay
ipam:
config:
-
subnet: 10.0.9.0/24
View stackup.sh
#!/bin/sh
export STACK_NAME='test'
mkdir -p ~/data/${STACK_NAME}/redis
STACK_NAME=${STACK_NAME} docker stack deploy --compose-file sample-stack.yml ${STACK_NAME}
View stackdn.sh
#!/bin/sh
export STACK_NAME='test'
docker stack rm ${STACK_NAME}
View sample-stack.yml
version: "3.4"
networks:
servicenet:
driver: overlay
ipam:
config:
-
subnet: 10.0.9.0/24
View eKatana.c
#include <Arduino.h>
#include "Adafruit_BLE.h"
#include "Adafruit_BluefruitLE_SPI.h"
#include "Adafruit_BluefruitLE_UART.h"
#include <Adafruit_LSM9DS0.h>
#include <Adafruit_Simple_AHRS.h>
#include "BluefruitConfig.h"
Adafruit_BluefruitLE_SPI ble(BLUEFRUIT_SPI_CS, BLUEFRUIT_SPI_IRQ, BLUEFRUIT_SPI_RST);