Skip to content

Instantly share code, notes, and snippets.

View cjus's full-sized avatar

Carlos Justiniano cjus

View GitHub Profile
@cjus
cjus / build_birds.py
Created September 27, 2026 23:32
build_birds.py
"""Build birds.db, the practice database for the AIE250 SQLite guide.
Run it from the folder you want the database in:
python build_birds.py
It deletes any birds.db already there and builds a fresh one, so you can
always get back to a clean copy by running it again. It uses only the Python
standard library.
@cjus
cjus / multi-moose.md
Last active May 12, 2025 02:27
Running multiple Moose projects

The Moose CLI is designed to run a single instance of the Moose stack locally. Running multiple Moose projects simultaneously on the same machine leads to port conflicts, as each instance tries to bind to the same default ports. This issue doesn’t arise when using separate machines, virtual machines, or container orchestrators like Docker, Kubernetes, Amazon ECS, or EKS.

However, with a few adjustments, you can run multiple Moose projects locally—and even enable them to communicate with each other if needed.

Each project includes a moose.config.toml file, which defines port mappings for the Moose stack’s services. To avoid conflicts, simply modify these port assignments for each project instance.

For example, suppose the default config includes:

[http_server_config]
@cjus
cjus / cmatrix.md
Created March 29, 2024 14:46
cmatrix container
FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install -y cmatrix && \
    rm -rf /var/lib/apt/lists/*

CMD ["cmatrix"]
@cjus
cjus / redpanda-install-on-gke.md
Created February 23, 2024 15:45
Redpanda Install on GKE
@cjus
cjus / moose-cli-notes.md
Last active February 20, 2024 17:53
Moose CLI code notes
@cjus
cjus / solution.py
Last active December 31, 2023 18:23
Code test solution
import sys
import time
"""
Solution Notes:
- The code shown here is larger than necessary. I think it's easier to discuss the code solution before it's optimized.
- There are also number of helper functions / features which I could have delete.
- One of my early design decisions was to go with immutable states. That allows me to playback moves as I spent time learning the rules of the game.
- This also proved to be an important decision when it came to my own testing and validation.
- Since I chose to use immutable states I also decided to go with a State Space Search Tree.
@cjus
cjus / shutdown.sh
Created August 28, 2020 13:47
Hydra service - simple shutdown
docker stop hydra-router
docker stop redis
@cjus
cjus / startup.sh
Created August 28, 2020 12:59
Hydra service - simple startup
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 June 5, 2019 13:44
Hacking Alzheimers using Light Therapy
// 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 August 3, 2018 15:16
Sample job queue code
const redis = require('redis');
const moment = require('moment');
class JobQueue {
constructor() {
this.config = null;
this.redisdb = null;
this.redisKey;
}