Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓

Carlos Justiniano cjus

🤓
View GitHub Profile
@cjus
cjus / shutdown.sh
Created Aug 28, 2020
Hydra service - simple shutdown
View shutdown.sh
docker stop hydra-router
docker stop redis
@cjus
cjus / startup.sh
Created Aug 28, 2020
Hydra service - simple startup
View startup.sh
HOSTIP=`echo "show State:/Network/Global/IPv4" | scutil | grep PrimaryInterface | awk '{print $3}' | xargs ifconfig | grep inet | grep -v inet6 | awk '{print $2}'`
echo "Host IP: ${HOSTIP}"
docker run -d -p 6379:6379 --rm --name redis redis:6.0.6
sleep 5
docker run -d -p 5353:5353 --add-host host:${HOSTIP} --rm --name hydra-router pnxtech/hydra-router:1.7.0
@cjus
cjus / alights.ino
Created Jun 5, 2019
Hacking Alzheimers using Light Therapy
View alights.ino
// Project on Github: https://github.com/cjus/brainlights
#include <Arduino.h>
#include <string.h>
#include <math.h>
#include <Wire.h>
#include <Adafruit_NeoPixel.h>
#define DEBUG
#define LEDPIN 4
#define BUTTONPIN 3
@cjus
cjus / jobqueue.js
Created Aug 3, 2018
Sample job queue code
View jobqueue.js
const redis = require('redis');
const moment = require('moment');
class JobQueue {
constructor() {
this.config = null;
this.redisdb = null;
this.redisKey;
}
@cjus
cjus / message.js
Created Jul 25, 2018
Message processing snipit
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...
@cjus
cjus / segment-transfer.js
Created Jul 24, 2018
Job queuing example
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}
@cjus
cjus / compose.yml
Created Jul 20, 2018
Docker stack running Redis
View compose.yml
version: "3.4"
networks:
servicenet:
driver: overlay
ipam:
config:
-
subnet: 10.0.9.0/24
@cjus
cjus / stackup.sh
Created Jul 18, 2018
Sample stackup script
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}
You can’t perform that action at this time.