Skip to content

Instantly share code, notes, and snippets.

Carlos Justiniano cjus

Block or report user

Report or block cjus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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}
@cjus
cjus / stackdn.sh
Last active Jul 18, 2018
Stack down script
View stackdn.sh
#!/bin/sh
export STACK_NAME='test'
docker stack rm ${STACK_NAME}
@cjus
cjus / sample-stack.yml
Created Jul 18, 2018
Sample stack compose
View sample-stack.yml
version: "3.4"
networks:
servicenet:
driver: overlay
ipam:
config:
-
subnet: 10.0.9.0/24
You can’t perform that action at this time.