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 / RefreshFormula.gs
Last active March 16, 2021 20:01
Google Sheets script: function refreshFormula(aToResfresh); For each cell in the array, force refresh the containing formula.
/**
* Google Sheets script: function refreshFormula(aToResfresh)
* For each cell in the array, force refresh the containing formula.
*
* @param {Array} aToResfresh The array of cells with formula to force refresh.
* @return {Void}
*/
function refreshFormula(aToResfresh = []) {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(),
sheet = spreadsheet.getActiveSheet(),
@EthraZa
EthraZa / DTB_2014_Municipios.sql
Last active May 10, 2021 04:17
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/
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 / Estados_array.json
Last active May 10, 2021 04:18
Array de Arrays com Estados[0] e Siglas[1] do Brasil. Baseado em https://github.com/felipefdl/cidades-estados-brasil-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 / DO_upd_domain.sh
Last active July 20, 2021 16:52
Digital Ocean - Update DNS records with Droplets internal private IPs and hostname
#!/bin/bash
#
# Digital Ocean - Update DNS records with Droplets internal private IPs and hostname
# DO_upd_domain.sh:
#
# 2021-07-20 - v1.1 - By EthraZa <Allan Brazute>
# Add: Update only powers and --flush switch to recreate the domain
#
# 2021-07-15 - v1.0 - By EthraZa <Allan Brazute>
#
@EthraZa
EthraZa / sshd.sh
Created July 8, 2019 16:51
Termux simple init script - Goes in $PREFIX/etc/profile.d/
ENABLED=1
PROC="sshd"
CMD=$PROC
if [ $ENABLED = 1 ] ; then
if pgrep -f $PROC >/dev/null ; then
echo "[$PROC is running]"
else
echo "[Starting $PROC...]" && $CMD && echo "[OK]"
fi
@EthraZa
EthraZa / sync2incron.sh
Created August 25, 2016 20:24
Script for incron to add or remove entries from an incrontab file
#!/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 $$@/$$#
#
@EthraZa
EthraZa / Adminer_FS_SQL.js
Created October 18, 2022 14:35
Adminer SQL Edit Fullscreen Bookmarklet - https://bookmarkify.it/53844
/**
:: Adminer.org SQL Edit Fullscreen Bookmarklet ::
Add to your bookmarks using: https://bookmarkify.it/53844
How to: Click the bookmark when editing a SQL command in Adminer. Press ESC to exit fullscreen.
*/
var s = document.getElementsByClassName('sqlarea')[0];
if (s) {
s.style.backgroundColor = window.getComputedStyle(document.body, null).getPropertyValue('background-color');
s.requestFullscreen();
}
@EthraZa
EthraZa / cfop.sql
Created February 29, 2016 15:55
Tabela (MySQL) de Código Fiscal de Operações e Prestações - CFOP
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`)