Skip to content

Instantly share code, notes, and snippets.

View MarcioGomes78's full-sized avatar
💻
Focusing

Marcio Gomes MarcioGomes78

💻
Focusing
View GitHub Profile
@adrianoluis
adrianoluis / git-sweep.sh
Last active March 20, 2026 20:01
Update master in all git repo under the provided directory or if missing uses running directory.
#!/usr/bin/env bash
set -euo pipefail
# git-sweep — Recursively find git repos and perform maintenance:
# - Stash local changes (and show the diff)
# - Switch to default branch, pull latest
# - Optionally: clean untracked files, garbage collect, prune branches
# - Report new commits, changed files, and pruned branches
# - Switch back and restore stash
#
@adrianoluis
adrianoluis / DocumentUtil.java
Last active November 3, 2025 19:33
Utility class to validate CPF and CNPJ document types. For CPF use isValidSsn and for CNPJ use isValidTfn. Added to repo https://github.com/adrianoluis/misc-tools
public class DocumentUtil {
// CPF
private static final int[] WEIGHT_SSN = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2};
// CNPJ
private static final int[] WEIGHT_TFN = {6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2};
private static int sum(int[] weight, char[] numbers, int length) {
if (length <= 0) return 0;