View countdown.sh
#!/bin/bash
COUNTER=$1
while [ $COUNTER -gt 1 ]; do
let COUNTER=COUNTER-1
echo -ne "Seconds remaining: $COUNTER\033[0K\r"
sleep 1
done
echo -ne "\033[0K\r"
View config.json
{
"hydra": {
"serviceName": "caller",
"serviceDescription": "",
"serviceIP": "",
"servicePort": 0,
"serviceType": "",
"redis": {
"url": "redis://localhost:6379/15"
}
View node-interfaces.md
const os = require('os');
let interfaces = os.networkInterfaces();
Object.keys(interfaces).
  forEach((interface) => {
    interfaces[interface].forEach((interfaceRecord)=>{
      if (interfaceRecord.family === 'IPv4') {
        console.log(`${interface}: ${interfaceRecord.address}`);
      }
View `Hydra-workshop.md
View nodejs-project-backup.md

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.
View Deployment-instructions.md

Deployment instructions

Push the project to a machine, then:

$ npm install

Make sure you have Node NSP installed.

View learning-docker.md

Notes while learning Docker

These notes are derived from my efforts in working through The Docker Book: Containerization is the new virtualization written by James Turnbull. I highly recommend getting a copy of Jame's book which is an $8 dollar e-book on Amazon.

The following notes are my own and simply an interpretation of what James has written. Caveat lector.

Ensuring Docker is ready

$ docker info
View microservices-and-databases.md

Microservices and databases

Some thoughts on Microservices and databases

One of the recommended best practices for microservices is that each service have its own database - when practical. The goal is to reduce the potential impact that a single database migration change might have across a collection of services. Think of a relational database change, which isn't schema-less by nature, and how each depending service might be impacted prior to a production release. In complex systems identifying impact across subsystems becomes a project in and of itself.

By ensuring that each microservices has its own database, the impact of change may be isolated or at least kept at bay.

However, this does raise an import question and opportunity. At the level of a microservices, what is the right database to use? The reason this question is also an opportunity is because we can think about database requirements in the context of a what an ind

View semicolon.md

While working in Javascipt we need to quickly append semi-colons to most lines. These settings modify Atom to map command-; to add a semi-colon to the end of the current line.

In init.coffee:

atom.commands.add 'atom-text-editor', 'custom:semicolonize', ->
  editor = @getModel()
  editor.moveToEndOfLine()
  editor.insertText(';')
View geolatlnglib
/**
* @name geolatlnglib
* @description utilities for lat lng calculations
* @author Carlos Justiniano
*/
//http://stackoverflow.com/questions/27928/how-do-i-calculate-distance-between-two-latitude-longitude-points
function getDistanceFromLatLonInKm(lat1, lon1, lat2, lon2) {
'use strict';
var R = 6371; // Radius of the earth in km