Skip to content

Instantly share code, notes, and snippets.

View disouzam's full-sized avatar
🚲

Dickson Souza disouzam

🚲
View GitHub Profile
@disouzam
disouzam / processa_microdados_sus_sih_rd
Created February 1, 2026 00:21 — forked from fernandobarbalho/processa_microdados_sus_sih_rd
Script para gerar arquivos com dados anuais de internação hospitalar do sus
library(microdatasus)
library(tidyverse)
estados<- c("AC","AL","AM", "AP", "BA","CE","DF","ES","GO","MA","MT","MS","MG","PA","PB", "PR","PE","PI","RJ","RS","RN","RO","RR","SC","SP","SE","TO")
download.file("ftp://ftp.datasus.gov.br/dissemin/publicos/SIHSUS/200801_/Doc/IT_SIHSUS_1603.pdf", destfile = "documentacao.pdf", mode= "wb", method = "libcurl" )
@disouzam
disouzam / settings.json
Created January 31, 2026 22:32
VS Code User settings
{
}
@disouzam
disouzam / rebase_check.sh
Created January 26, 2026 13:06
Check correctness of rebase operation
#!/bin/bash
function rebase_check() {
echo -e "Checking if rebase was correct..." > rebase-check.md
echo -e "\n==============================" >> rebase-check.md
echo -e "References before rebase: $1..$2\n" >> rebase-check.md
git fl2 $1 -n1 >> rebase-check.md
echo "" >> rebase-check.md
git fl2 $2 -n1 >> rebase-check.md
@disouzam
disouzam / get_short_log.sh
Created January 26, 2026 12:36
Get git short log, diff stats and diff patches with a single command
#!/bin/bash
function get_short_log() {
sanitized_commits=$(sed 's/\.\././g' <<< "$1")
commit1=$(echo "$sanitized_commits" | cut -d '.' -f 1)
commit2=$(echo "$sanitized_commits" | cut -d '.' -f 2)
echo -e "=============================="
echo -e "Short log between $commit1 and $commit2:\n"
git shortlog --group=author $commit1..$commit2
@disouzam
disouzam / get_file_url.sh
Created January 25, 2026 23:53
Get file URL in a git repository
#!/bin/bash
function get_file_url() {
repourl=$(echo "$(git config --get remote.origin.url)" | sed -e 's/git@/https:\/\//' -e 's/\.git$//')
branch=$(git branch --show-current)
relative_file_path=$(echo $1 | sed -e 's/\\/\//g')
echo $repourl/blob/$branch/$relative_file_path
}
@disouzam
disouzam / get-commit-url.sh
Created January 25, 2026 18:01
Get commit remote URL via command line using Bash
#!/bin/bash
function get_commit_url() {
echo "$(git config --get remote.origin.url)" | \
sed -e 's/git@/https:\/\//' -e 's/\.git$//' \
| awk -v sha="$(git rev-parse $1)" '{print $0"/commit/"sha}'
}
@disouzam
disouzam / inspect-git.sh
Created January 14, 2026 18:49
Script to use for tutorial purposes on Git
#!/bin/bash
# A script to inspect the current Git repository status and display relevant information.
file_name="files-in-git"
old_file="${file_name}_old.txt"
new_file="${file_name}.txt"
function generate_git_file_list() {
ls -1 -R .git > $1
}
@disouzam
disouzam / .gitignore
Last active January 12, 2026 12:21 — forked from Shivani-Gonde/BlogPost_Cu_Met_CA4Py_BP1_ProcessModel.rst
Cu Pyrometallurgy process model
custom_scripts/
.vscode/
pyproject.toml
poetry.lock
*.equi
*.cst
@disouzam
disouzam / github.py
Created January 1, 2026 01:23 — forked from lemire/github.py
Get your GitHub activity for 2025
#!/usr/bin/env python3
# uv run lemire.py --token <your_github_token> --user <github_username>
#
# To generate a GitHub Personal Access Token:
# 1. Go to https://github.com/settings/tokens
# 2. Click "Generate new token (classic)"
# 3. Give it a name, e.g., "GitHub Search Script"
# 4. Select scopes: For public repositories, select "public_repo". For private, select "repo".
# 5. Click "Generate token"
# 6. Copy the token and use it as --token argument.
@disouzam
disouzam / bash_strict_mode.md
Created December 11, 2025 10:41 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation