Skip to content

Instantly share code, notes, and snippets.

View MatMercer's full-sized avatar
🎯
Focusing

Mateus Mercer MatMercer

🎯
Focusing
View GitHub Profile
@MatMercer
MatMercer / archive.sh
Created April 4, 2022 16:47
Archive files by year and month from the current folder in bash
#!/bin/bash
currentYearMonth=$(date "+%Y-%m")
echo "Ignoring files from $currentYearMonth"
find . -maxdepth 1 -not -name "archive.sh" -print0 | while read -d $'\0' file
do
excludeDate=0
[[ "$file" =~ [0-9]{4}-[0-9]{2} ]] && excludeDate=1
@MatMercer
MatMercer / yt-dl-termux.sh
Last active September 29, 2025 22:34
Download youtube, twitter, youtube shorts, tiktok, reddit videos with termux app in android
#!/bin/sh
# helper script to download videos using termux and auto-indexing them
#
# required apps:
# termux: https://f-droid.org/en/packages/com.termux/
# termux-api: https://f-droid.org/en/packages/com.termux.api/
# required packages
# termux-api, python: apt install termux-api python python3
@MatMercer
MatMercer / README.md
Created January 28, 2023 19:53
Generate bcrypt password from command line

Generate a 16 chars password

excludechars=\`

htpasswd -bnBC 10 "" $(pwgen -sncBy -r "$excludechars" 16 1 | tee /dev/tty | tr -d '\n') | tr -d ':'
  • htpasswd -bnBC 10 ""
    • -b use password from command line
@MatMercer
MatMercer / shrink-docker-desktop-vhdx.ps1
Created July 4, 2024 20:15
Shrink docker desktop too huge virtual disk. Shrink docker desktop ext4 WSL Windows 10 11
# Script to shrink docker desktop data, a common issue at WSL 2
# Most of the script is generated with ChatGPT
# Check if the script is running as administrator
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal($currentUser)
if (-not $currentPrincipal.IsInRole($adminRole)) {
Write-Host "Requesting administrator privileges..."
Start-Process powershell -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs