Skip to content

Instantly share code, notes, and snippets.

View cgomesu's full-sized avatar
💭
I may be slow to respond.

Carlos Gomes cgomesu

💭
I may be slow to respond.
View GitHub Profile
@cgomesu
cgomesu / download-covid19-datasus.sh
Created December 4, 2023 14:56
Script para baixar dados Covid-19 em CSV
#!/usr/bin/env bash
# download Covid-19 CSV files from the OpenDataSUS website
# dependencias: curl, gzip, grep, sort
URL="https://opendatasus.saude.gov.br/dataset/covid-19-vacinacao/resource/301983f2-aa50-4977-8fec-cfab0806cb0b"
REGEX_CSVS="http(s)://.*.csv"
ARQUIVO_URL_CSVS="csv.urls"
DIR_CSVS="./csvs/"
@cgomesu
cgomesu / JC VAE - Variational Inference.md
Last active October 8, 2023 17:45
Estrutura dos encontros do JCVAE sobre inferencia variacional
# assuming the extension is .zip and the zip files are in your current dir
for f in ./*.zip; do mkdir "${f%.zip}"; unzip -d "${f%.zip}" "$f"; done
@cgomesu
cgomesu / how-to-downgrade-with-apt.md
Created February 2, 2023 19:14
Downgrading packages in APT-based distros

How to downgrade a package in APT-based distros

  1. Check latest package upgrades in /var/log/dpkg.log:

    cat /var/log/dpkg.log | grep -i upgrade

    which should output something like this:

@cgomesu
cgomesu / binance_clean_csv.sh
Created December 14, 2022 16:07
Script Bash interativo que faz limpeza básica em arquivo de dados da Binance através do pacote csvkit para Python.
#!/usr/bin/env bash
# takes msg ($1) and status ($2) as args
end () {
echo ''
echo '*********************************************'
echo '* O script terminou de ser executado.'
echo "* Mensagem: $1"
echo '*********************************************'
exit "$2"
@cgomesu
cgomesu / monit_mesh_nodes.sh
Created December 14, 2022 16:02
Shell script that pings multiple hosts and reboots if unable to reach any host. This script was originally used as a connectivity watchdog for OpenWrt mesh nodes.
#!/usr/bin/env sh
####################################################
# Mesh watchdog to monitor node-to-node connectivity
####################################################
# This is IP 192.168.10.1
HOST01=10.10.10.2
HOST02=192.168.10.30
HOST03=192.168.10.10
@cgomesu
cgomesu / monit_laptop_battery.sh
Created December 14, 2022 15:56
Bash script that checks a laptop battery status via sysfs and performs automatic shutdown if capacity is below a user-specified threshold (30% by default)
#!/usr/bin/env bash
##################
# Battery watchdog
##################
DEFAULT_BAT="BAT0"
DEFAULT_CAPACITY_LOW='30'
capacity_now () {