Skip to content

Instantly share code, notes, and snippets.

View cjus's full-sized avatar
🤓

Carlos Justiniano cjus

🤓
View GitHub Profile
@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 / jsonval.sh
Created June 26, 2011 17:42
Extract a JSON value from a BASH script
#!/bin/bash
function jsonval {
temp=`echo $json | sed 's/\\\\\//\//g' | sed 's/[{}]//g' | awk -v k="text" '{n=split($0,a,","); for (i=1; i<=n; i++) print a[i]}' | sed 's/\"\:\"/\|/g' | sed 's/[\,]/ /g' | sed 's/\"//g' | grep -w $prop`
echo ${temp##*|}
}
json=`curl -s -X GET http://twitter.com/users/show/$1.json`
prop='profile_image_url'
picurl=`jsonval`
@cjus
cjus / .docker_aliases
Last active July 13, 2023 23:50
Docker aliases
#!/bin/sh
alias dm='docker-machine'
alias dmx='docker-machine ssh'
alias dk='docker'
alias dki='docker images'
alias dks='docker service'
alias dkrm='docker rm'
alias dkl='docker logs'
alias dklf='docker logs -f'
@cjus
cjus / sample-nginx.conf
Last active July 12, 2023 14:59
AngularJS Nginx and html5Mode
server {
server_name yoursite.com;
root /usr/share/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
}
@cjus
cjus / eKatana.c
Last active May 18, 2022 22:49
eKatana test code
#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);
@cjus
cjus / nodejs-project-backup.md
Last active January 2, 2021 16:58
NodeJS project backup script

NodeJS project backup script

The following shell script backups up the currrent node project by performing the following actions:

  • Assumes that the back script is bundled with the actual NodeJS projecxt foler.
  • Uses the current directory as the backup file name.
  • Moves to the parent folder to create a tarball using the project name and the current date stamp and excludes the node_modules folder.
  • Lists the backups created using the script.
@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