Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View EthraZa's full-sized avatar
🏠
Working from home

Allan Brazute EthraZa

🏠
Working from home
View GitHub Profile
@EthraZa
EthraZa / BorgBackup.sh
Last active December 13, 2019 08:26
A Borg Backup script for a centralized storage server to backup other servers
#!/bin/bash
##
# BORG Backup
#
# [1.0] 2014-10-30 :: Allan Brazute
# - Assimilation
#
# All hosts need to have ssh and borg
# Backup Repository host may also need a compress tool like pigz
@EthraZa
EthraZa / spiderstruct.php
Last active June 6, 2019 12:00
Spider Struct :: Mirror files from some remote place, based on a source directory structure, to a distination directory
<?php
/**
* Spider Struct - by Allan.Brazute
* Mirror files from some remote place, based on a source directory structure, to a distination directory
*
* Usage: spiderstruct.php /local_src_structure_path/ /output_path/ http://base_url/
*/
$localSrc = (isset($argv[1]) && $argv[1])? $argv[1] : '';
$localDst = (isset($argv[2]) && $argv[2])? $argv[2] : '';
@EthraZa
EthraZa / backmark.sh
Created October 27, 2017 20:28
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.
#!/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 / lets-issue-cert.sh
Last active October 6, 2017 19:58
Issue a LetsEncrypt SSL certificate using acme.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 / mysqldumpstream.sh
Created August 15, 2017 18:09
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
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 / checkIE.php
Last active May 23, 2016 17:43
Funções de validação de Inscrição Estadual
<?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
//
// 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 / ec2ab.sh
Last active March 26, 2016 18:25
Simple ec2-automate-backup runner
#!/bin/bash -
###
# Simple ec2-automate-backup runner
# Author: Allan Brazute
###
# Setup
BKP_DEVICES_PATHS="/var/lib/mongo /var/lib/mysql"
BKP_KEEP_DAYS=7