Skip to content

Instantly share code, notes, and snippets.

View marviorocha's full-sized avatar
💻
Focusing

Marvio Rocha marviorocha

💻
Focusing
View GitHub Profile
@marviorocha
marviorocha / 1 setup vps
Created February 24, 2018 15:13 — forked from PavloBezpalov/1 setup vps
Deploy Rails 5.1.1 to VPS(Ubuntu 16.04.2 LTS). Nginx mainline + pagespeed, Puma with Jungle, Capistrano3, PostgreSQL 9.6, RVM, Certbot
root# apt-get update
root# apt-get upgrade
// dependencies for Ruby
root# apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev \
libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev \
libpcre3-dev unzip
// Node.js v7
root# curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
@marviorocha
marviorocha / README.md
Created April 26, 2018 15:31 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@marviorocha
marviorocha / postgres-cheatsheet.md
Created June 18, 2018 23:53 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
Banco de imagem grátis:
- https://br.freepik.com (vetor)
- https://unsplash.com/
- http://realisticshots.com
- http://realisticshots.com/
- https://pixabay.com/
- https://www.lifeofpix.com/
- https://gratisography.com/
- http://freenaturestock.com/
- https://magdeleine.co/license/cc0/
@marviorocha
marviorocha / .dockerignore
Created November 13, 2018 19:00 — forked from davidderus/.dockerignore
Docker + Rails + Puma + Postgres + Nginx
.git
.gitignore
/doc
.yardoc
coverage
jsdoc
/tmp
/log
Dockerfile
Dockerfile.prod
{"lastUpload":"2020-04-29T11:08:00.615Z","extensionVersion":"v3.4.3"}
@marviorocha
marviorocha / CNPJ Validator Rails
Last active October 26, 2020 12:15
Ruby On Rails Validator CNPJ
class CnpjValidator < ActiveModel::EachValidator
class InvalidCNPJ < StandardError; end
EXPECTED_FORMAT = /^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
FIRST_CHECKER_DIGITS_MULTIPLIERS = [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
SECOND_CHECKER_DIGITS_MULTIPLIERS = [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
def validate_each(record, attribute, value)
return unless value.present?
@marviorocha
marviorocha / Deploy with Dokku
Last active October 26, 2020 12:23
Guia de comandos para deploy no Dokku
# Criar uma aplicação no Dokku
dokku apps:create appname
# Criar e "linkar" um banco de dados PostgreSQL
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
dokku postgres:create appname_production
dokku postgres:link appname_production appname
dokku postgres:list
# Criar e "linkar" uma instância do Redis (Não rodei esses comandos no vídeo)
@marviorocha
marviorocha / wp-permissions-script
Created May 19, 2021 23:33 — forked from macbleser/wp-permissions-script
WordPress Permissions Configuration Script
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro
#
WP_OWNER=changeme # &lt;-- wordpress owner
WP_GROUP=changeme # &lt;-- wordpress group
WP_ROOT=/home/changeme # &lt;-- wordpress root directory
Station Pro Privacy Policy
This Privacy Policy describes how your personal information is collected, used, and shared when you visit or make a purchase from stationpro.co (the “Site”).
PERSONAL INFORMATION WE COLLECT
When you visit the Site, we automatically collect certain information about your device, including information about your web browser, IP address, time zone, and some of the cookies that are installed on your device. Additionally, as you browse the Site, we collect information about the individual web pages or products that you view, what websites or search terms referred you to the Site, and information about how you interact with the Site. We refer to this automatically-collected information as “Device Information.”
We collect Device Information using the following technologies: