Skip to content

Instantly share code, notes, and snippets.

View binario200's full-sized avatar

Victor Hernandez binario200

View GitHub Profile
@binario200
binario200 / NodeHints.md
Last active May 6, 2018 02:41
node hints

Generators are function execution contexts that can be paused and resumed.

A Generator function will yield a value then stop but the function context of a Generator is not disposed of (as it is with normal functions). You can re-enter the Generator at a later point in time and pick up further results

function* threeThings() {
    yield 'one';
    yield 'two';
    yield 'three';
}
# copyng files from an outside box to you directory
scp -i infolob-analytics.pem ubuntu@54.147.173.72:/home/ubuntu/.pm2/logs/index-out-0.log .
# running image, configuring port, environment var
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=visualuser -e POSTGRES_USER=visualuser -d postgres
# running a continaer and attaching it
docker run -i -t centos
@binario200
binario200 / PowerShellAzureCI-CD.md
Last active April 30, 2018 13:46
Powershell azure CI/CI

brew tap caskroom/cask Now, you can install PowerShell:

brew cask install powershell Finally, verify that your install is working properly:

pwsh When new versions of PowerShell are released, simply update Homebrew's formulae and upgrade PowerShell:

brew update

@binario200
binario200 / README.md
Created April 29, 2018 19:10 — forked from JamesMenetrey/README.md
Install Oh-My-Zsh + iTerm2 with Solarized + System-wide console in 2017 (macOS)

Install iTerm2 with Solarized in 2017

Here is the looks and feel of your terminal once the tutorial has been applied on your system:

Install iTerm2

Using Homebrew:

@binario200
binario200 / JSRecipes.MD
Last active April 25, 2018 14:16
Javascript recipes

Copy an object but reseting its values

function skeleton(source, isArray) {
   var o = Array.isArray(source) ? [] : {};
   for (var key in source) {
      if (source.hasOwnProperty(key)) {
         var t = typeof source[key];
 o[key] = t == 'object' ? 
@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