Skip to content

Instantly share code, notes, and snippets.

View jonasporto's full-sized avatar
⌨️
Working and having fun!

Jonas Porto jonasporto

⌨️
Working and having fun!
  • Rio de Janeiro, Brazil
View GitHub Profile
@jonasporto
jonasporto / gist:26140acc520d369a2e364fdd8540d25c
Created July 10, 2017 20:44 — forked from barelyknown/gist:3692433
Send Email From Rails Console
# Simple approach to sending email from the Rails console
# Implementation idea courtesy of Steve Klabnik
# http://blog.steveklabnik.com/posts/2012-09-09-random-ruby-tricks--class-new
# Create the mailer class with a block and assign to a variable
mailer = Class.new(ActionMailer::Base) do
def example_message
mail(to: "[email protected]", from: "[email protected]", subject: "Example Message") do |format|
format.text { render text: "Example message body" }
end
@jonasporto
jonasporto / AWSRegionsAndAZs.md
Created May 22, 2017 20:57
List of AWS availability zones for each AWS region
AWS region code AWS region name Number of AZs AZ names
us-east-1 Virginia 4 us-east-1a, us-east-1b, us-east-1c, us-east-1e
us-west-1 N. California 2 us-west-1a, us-west-1b
us-west-2 Oregon 3 us-west-2a, us-west-2b, us-west-2c
eu-west-1 Ireland 3 eu-west-1a, eu-west-1b, eu-west-1c
eu-central-1 Frankfurt 2 eu-central-1a, eu-central-1b
ap-southeast-1 Singapore 2 ap-southeast-1a, ap-southeast-1b
ap-southeast-2 Sydney 2 ap-southeast-2a, ap-southeast-2b, ap-southeast-2c
ap-northeast-1 Tokyo 2 ap-northeast-1a, ap-nort
@jonasporto
jonasporto / MySQL_macOS_Sierra.md
Created May 21, 2017 09:27 — forked from nrollr/MySQL_macOS_Sierra.md
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

$1, $2, $3, ... are the positional parameters.
"$@" is an array-like construct of all positional parameters, {$1, $2, $3 ...}.
"$*" is the IFS expansion of all positional parameters, $1 $2 $3 ....
$# is the number of positional parameters.
$- current options set for the shell.
$$ pid of the current shell (not subshell).
$_ most recent parameter (or the abs path of the command to start the current shell immediately after startup).
$IFS is the (input) field separator.
$? is the most recent foreground pipeline exit status.

setting autocorrect from git commands

git config --global help.autocorrect 1

ex:

git pulll origin master

WARNING: You called a Git command named 'pulll', which does not exist. Continuing under the assumption that you meant 'pull' in 0.1 seconds automatically...

@jonasporto
jonasporto / heredoc-function.php
Created May 8, 2017 13:47 — forked from Pephers/heredoc-function.php
How to call a PHP function inside a Heredoc.
<?php
$cb = function ($fn) {
return $fn;
};
echo <<<HEREDOC
Hello, {$cb(ucfirst('world'))}
HEREDOC;
@jonasporto
jonasporto / upgrade-postgres-9.3-to-9.5.md
Created March 24, 2017 16:51 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main

Deploy DevOps

Este gist é um exercício para avaliar suas skills tecnicas para nosso processo seletivo de DevOps.

O desafio consiste em construir um ambiente Vagrant ou deploy em algum servidor composto por

A solução deve conter:

  • Load Balancer
  • 2 Servidores de aplicação

./lib/enum.js

module.exports = Object.freeze({
    IS_A_THING: 1,
    IS_ANOTHER_THING: 2
});

./lib/main.js

var myEnum = require('./enum');