Skip to content

Instantly share code, notes, and snippets.

View binario200's full-sized avatar

Victor Hernandez binario200

View GitHub Profile
@binario200
binario200 / Terraform-fixes.md
Last active April 22, 2018 06:14
A set of fixes for some common terraform issues.

Terraform state using a remote storage

In order to have the state of you terraform in a remote place let say at AWS S3 you need to :

  • You need to create the bucket at AWS S3 using terraform
  • you need to add backend to indicate that you will use the bucket created to store the terraform state (encryting it)

provider "aws" {
@binario200
binario200 / memoizing.md
Created April 8, 2018 22:00
Memoizing with is prime function
function isPrime(value) {
   // creates the cache
   if(!isPrime.answeres) {
      isPrime.answers = {};
   }
   
   // checks for cached values
 if (isPrime.answers[value] !== undefined) {
@binario200
binario200 / UniqueFuncsCollections.md
Last active April 8, 2018 21:47
Storing a collection of unique functions
var store = {
  nextId: 1,
  cache: {},
  add: function(fn) {
     if (!fn.id) {
        fn.id = this.nextId++;
        this.cache[fn.id] = fn;
        return true;
 }
@binario200
binario200 / HowScaleAndDistributedSystems
Created March 23, 2018 01:39
Scalable Web Architecture and Distributed Systems
Links to intiated me in the road to design Scalable and Distributed Systems.
General ideas to architect a web application and how to scalate it.
http://www.aosabook.org/en/distsys.html#
How to did Flickr to solve its scalability issues.
https://www.scribd.com/doc/2592098/DVPmysqlucFederation-at-Flickr-Doing-Billions-of-Queries-Per-Day
Memcache at Facebook
@binario200
binario200 / privateKeyAndCertInNodejs.md
Last active March 13, 2018 21:01
how to create private key and certificate to use in a nodejs app.

TLS Socket: server and client The only major differences between this and a regular TCP connection are the private Key and the public certificate that you’ll have to set into an option object. How to Create a Key and Certificate The first step in this security process is the creation of a private Key. And what is this private key? Basically, it's a set of random noise that's used to encrypt information. In theory, you could create one key, and use it to encrypt whatever you want. But it is best practice to have different keys for specific things. Because if someone steals your private key, it's similar to having someone steal your house keys. Imagine if you used the same key to lock your car, garage, office, etc.

openssl genrsa -out private-key.pem 1024

Once we have our private key, we can create a CSR (certificate signing request), which is our request to have the private key signed by a fancy authority. That is why you have to input information related to your company. This information will be seen by the

@binario200
binario200 / side-car-container-pattern.md
Created February 11, 2018 20:36
how to use side car pattern to get process information from a container

in order to get container/application process information liking a topz container to an running container application example:

the container application:

docker run -d --name kuard --publish 8080:8080 gcr.io/kuar-demo/kuard-amd64:1
curl http://localhost:8080  ## will application information
## getting the container id to attach it the topz container
@binario200
binario200 / MavenRecipes.md
Created January 24, 2018 22:38
Maven recipes
@binario200
binario200 / Nodejs-Interview.md
Last active January 18, 2018 00:29
Nodejs Challenge

Let's code some JS!

Hey, welcome to the first coding challenge of your interview process

The Prereqs

This challenge assumes your knowledge or skills to leverage on the following topics,

  • Vanilla JavaScript (or plain JavaScript)
  • NodeJS
  • Express
@binario200
binario200 / angularNotes.md
Created January 2, 2018 01:03
AngularJs notes

npm install -g typescript

@binario200
binario200 / topNumbersInArray.js
Created November 27, 2017 04:17
gets the top three numbers in an array
var input = [6,7,3,8,2,5,8,9,2,3,3,1,4,5,5,5,2,3,5];
console.log(input.join(' '));
function top(arr) {
var sum = {};
var temp = arr;
var top = [null, null, null];
var first = 0;
var second = 0;