Skip to content

Instantly share code, notes, and snippets.

View crizstian's full-sized avatar

Cristian Ramirez crizstian

View GitHub Profile
@crizstian
crizstian / solid.js
Last active March 15, 2023 02:40
Code examples of SOLID principles for JavaScript
/*
Code examples from the article: S.O.L.I.D The first 5 priciples of Object Oriented Design with JavaScript
https://medium.com/@cramirez92/s-o-l-i-d-the-first-5-priciples-of-object-oriented-design-with-javascript-790f6ac9b9fa#.7uj4n7rsa
*/
const shapeInterface = (state) => ({
type: 'shapeInterface',
area: () => state.area(state)
})
harnessApiVersion: '1.0'
type: SSH
commandUnitType: INSTALL
commandUnits:
- artifactVariableName: artifact
commandUnitType: DOWNLOAD_ARTIFACT
deploymentType: SSH
name: Download Artifact
scriptType: POWERSHELL
workingDirectory: ${DownloadDirectory}

Keybase proof

I hereby claim:

  • I am crizstian on github.
  • I am cramirez92 (https://keybase.io/cramirez92) on keybase.
  • I have a public key ASAf0ztDX6gzipB6qWkAcQFFTrQzsFvbPSpLQc5R82uTngo

To claim this, I am signing this object:

@crizstian
crizstian / validate-joi-models.spec.js
Last active July 17, 2020 14:39
Example of testing joi validation
/* eslint-env mocha */
const test = require('assert')
const {validate} = require('./')
console.log(Object.getPrototypeOf(validate))
describe('Schemas Validation', () => {
it('can validate a booking object', (done) => {
const now = new Date()
now.setDate(now.getDate() + 1)
@crizstian
crizstian / tcp-secrets.tf
Created May 28, 2020 21:14
example of dynamic secrets with vault gcp engine
resource "vault_gcp_secret_roleset" "roleset" {
count = var.enable_gcp_dynamic_secret ? 1 : 0
backend = vault_gcp_secret_backend.gcp.0.path
roleset = "devops"
secret_type = "access_token"
project = "gcp-vault-admin"
token_scopes = ["https://www.googleapis.com/auth/cloud-platform"]
# to be done to set the appropiate bindings
@crizstian
crizstian / cinema.microservices.Dockerfile
Last active April 15, 2020 02:15
Example of Dockerfile for a nodejs app
# the first thing we specify in a Dockerfile is the base image.
# This is essentially bare bones alpine linux with node installed.
FROM node:7.5.0-alpine
# Creates a non-root-user.
RUN addgroup -S nupp && adduser -S -g nupp nupp
# Sets the HOME environment variable.
ENV HOME=/home/nupp

Keybase proof

I hereby claim:

  • I am crizstian on github.
  • I am cramirez92 (https://keybase.io/cramirez92) on keybase.
  • I have a public key ASD_C5CVq35LmMMaVGc7KRwyYvPCQGUiDyxv1QIXGzsgago

To claim this, I am signing this object:

MongoDB shell version v4.0.8
connecting to: mongodb://127.0.0.1:27017/?authSource=admin&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("26ef130b-42df-4aa3-bf71-a88c2d6dfb20") }
MongoDB server version: 4.0.8
{
...
"members" : [
{
"_id" : 0,
"name" : "10.0.3.175:27017",
// first lets switch to root user, since docker is running as root
ubuntu@ip-10-0-3-17:~$ sudo su
root@ip-10-0-3-17:/home/ubuntu# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
79e91c403bf3 mongo "docker-entrypoint.s…" 7 minutes ago Up 7 minutes 0.0.0.0:27017->27017/tcp 10-0-3-17
module.aero_bastion_network.aws_nat_gateway.nat_gateway: Still creating... (10s elapsed)
module.aero_mongo_cluster.aws_instance.vm.1: Still creating... (10s elapsed)
module.aero_mongo_cluster.aws_instance.vm.2: Still creating... (10s elapsed)
module.aero_mongo_cluster.aws_instance.vm.0: Still creating... (10s elapsed)
module.aero_bastion_instance.aws_instance.vm: Still creating... (10s elapsed)
module.aero_bastion_network.aws_nat_gateway.nat_gateway: Still creating... (20s elapsed)
module.aero_mongo_cluster.aws_instance.vm.1: Still creating... (20s elapsed)
module.aero_mongo_cluster.aws_instance.vm.2: Still creating... (20s elapsed)
module.aero_mongo_cluster.aws_instance.vm.0: Still creating... (20s elapsed)
module.aero_bastion_instance.aws_instance.vm: Still creating... (20s elapsed)