Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Allan Brazute EthraZa

🏠
Working from home
Block or report user

Report or block EthraZa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@EthraZa
EthraZa / Estados_array.json
Last active Feb 25, 2016
Array de Arrays com Estados[0] e Siglas[1] do Brasil. Baseado em https://github.com/felipefdl/cidades-estados-brasil-json
View Estados_array.json
[
["Acre", "AC"],
["Alagoas", "AL"],
["Amazonas", "AM"],
["Amapá", "AP"],
["Bahia", "BA"],
["Ceará", "CE"],
["Distrito Federal", "DF"],
["Espírito Santo", "ES"],
["Goiás", "GO"],
@EthraZa
EthraZa / DTB_2014_Municipios.sql
Last active Mar 2, 2016
Tabela simples (MySQL) com a lista atualizada de Códigos de Municípios do IBGE, com 7 dígitos, baseada na lista 2014 v2 em ftp://geoftp.ibge.gov.br/organizacao_territorial/divisao_territorial/2014/
View DTB_2014_Municipios.sql
CREATE TABLE IF NOT EXISTS `municipios` (
`id` int(7) NOT NULL,
`estado` varchar(19) COLLATE utf8_unicode_ci DEFAULT NULL,
`uf` char(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`municipio` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `municipios` (`id`, `estado`, `uf`, `municipio`) VALUES
(1100015, 'Rondônia', 'RO', 'Alta Floresta D\'Oeste'),
@EthraZa
EthraZa / ec2ab.sh
Last active Mar 26, 2016
Simple ec2-automate-backup runner
View ec2ab.sh
#!/bin/bash -
###
# Simple ec2-automate-backup runner
# Author: Allan Brazute
###
# Setup
BKP_DEVICES_PATHS="/var/lib/mongo /var/lib/mysql"
BKP_KEEP_DAYS=7
View tasks.json
//
// Visual Studio Code Arduino Tasks.json
// Author: Allan Brazute @ SpotApp
//
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
@EthraZa
EthraZa / checkIE.php
Last active May 23, 2016
Funções de validação de Inscrição Estadual
View checkIE.php
<?php
/*
* Funções de validação de Inscrição Estadual
*
* Fórmulas dos Fiscos das 27 UF's no Site do SINTEGRA:
* http://www.sintegra.gov.br/insc_est.html
*/
/**
* Checa Inscrição Estadual
@EthraZa
EthraZa / mysqldumpstream.sh
Created Aug 15, 2017
MySQL / MariaDB single shell command line to: 1- Dump DB from remote source server via SSH; 2- Compress dump with multithread bzip2; 3- Stream dump to local; 4- Uncompress dump; 5- Pipe through pv with a remote query to guess dump size to show progress bar; 6- Import dump to local DB
View mysqldumpstream.sh
ssh USER@REMOTE_SOURCE_SERVER 'mysqldump -uUSER -pPASSWORD --databases MYDATABASE | lbzip2' | lbunzip2 | pv -s `ssh USER@REMOTE_SOURCE_SERVER 'mysql -uUSER -pPASSWORD -e "SELECT ROUND(((SUM(DATA_LENGTH)*2)+SUM(INDEX_LENGTH))/3) B FROM information_schema.tables WHERE table_schema = \"MYDATABASE\";"| tail -n1'` |mysql -uUSER -pPASSWORD
@EthraZa
EthraZa / lets-issue-cert.sh
Last active Oct 6, 2017
Issue a LetsEncrypt SSL certificate using acme.sh
View lets-issue-cert.sh
#!/bin/bash
# Issue a LetsEncrypt SSL certificate using acme.sh
#
# ISPConfig 3 preparation:
# Enable the SSL option and Add a self-signed certificate on SSL tab within Sites/Domains to create the needed configurations.
#
if [ -z "$*" ]; then
printf "\n issue-cert.sh domain.com \n\n"
@EthraZa
EthraZa / backmark.sh
Created Oct 27, 2017
Backmark.sh Will create a pool of binary and text files with random content, duplicate then in two directories and backup it twice with multiple tools to compare their time and size.
View backmark.sh
#!/bin/bash
##
# Backmark.sh
#
# Will create a pool of binary and text files with random content,
# duplicate then in two directories and backup it twice
# with multiple tools to compare their time and size.
#
# Simple like that.
@EthraZa
EthraZa / cfop.sql
Created Feb 29, 2016
Tabela (MySQL) de Código Fiscal de Operações e Prestações - CFOP
View cfop.sql
SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
CREATE TABLE `cfop` (
`id` char(4) COLLATE utf8_unicode_ci NOT NULL,
`descricao` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`aplicacao` varchar(530) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`)
@EthraZa
EthraZa / sync2incron.sh
Created Aug 25, 2016
Script for incron to add or remove entries from an incrontab file
View sync2incron.sh
#!/bin/bash
###
# sync2incron - Script for incron to add or remove entries from an incrontab file
#
# Usage:
#
# - Add it to incron as something like:
# /root/path/to/monitor IN_CREATE,IN_DELETE /path/to/sync2incron.sh $% /etc/incron.d/myincrontab $@/$# IN_CLOSE_WRITE myscript $$@/$$#
#
You can’t perform that action at this time.