Cheatsheet
commands and tricks for day to day
- Delete All Commit History on GitHub
Reset a repository's commit history by creating an orphan branch
git checkout --orphan latest_branch git add -A git commit -am "reset configs" git branch -D main git branch -m main git push -f origin main - Send Text using ICMP
Encode and send text payload via ping, receive and decode with tshark
# Send payload=$(echo -n "Hello" | xxd -p) echo $payload len=$(($(echo $payload | wc -c | tr -s " ") + 2)) echo $len ping -s$len -c4 -p$payload 127.0.0.1 # Receive tshark -l -i lo0 -Y "icmp" -T fields -e data | xxd -r - Chrome Bookmarks (filter by folder)
Extract URLs from a specific Chrome bookmark folder using jq
cat ~/.config/google-chrome/Default/Bookmarks \ | jq -r '.roots.bookmark_bar.children[] | select(.name == "tree") | .children[] | select(.name == "blogs") | .children[] | .url' - Post-install Docker
Add current user to docker group after installation
sudo usermod -aG docker $USER exec su -l $USER groups $USER docker ps - k6 Load Testing
Basic k6 script with ramp-up, sustained load, and ramp-down stages
import http from 'k6/http'; import { sleep } from 'k6'; export const options = { stages: [ { duration: '10s', target: 100 }, { duration: '30s', target: 100 }, { duration: '10s', target: 0 } ] } export default function () { http.get('http://192.168.68.108:3000'); sleep(1); } - ntfy Send Notification
Send a push notification via ntfy.sh using curl
curl -d "Backup successful" ntfy.sh/mytopic - Convert Video for DaVinci Resolve
Convert MP4 to ProRes format compatible with DaVinci Resolve
ffmpeg -i input.mp4 -c:v prores -profile:v 3 -c:a pcm_s16le output.mov - Generate OpenTelemetry Traces
Generate 200 traces in a loop using telemetrygen
for i in $(seq 1 200); do echo $i telemetrygen traces --otlp-insecure --traces 1 --service telemetrygen sleep 0.5 done - curl with --resolve
Force curl to resolve a hostname to a specific IP address, bypassing DNS
curl --resolve meuservidor.com:8080:192.168.0.100 http://meuservidor.com:8080 curl --resolve google.com:8888:127.0.0.1 https://google.com:8888 - Chrome Internals Pages
Useful chrome:// internal pages for debugging DNS, events, and proxy settings
chrome://net-internals/#dns chrome://net-internals/#events chrome://net-internals/#proxy - Write to Container stdout/stderr
Send a message directly to a container's stdout or stderr via /proc
# stderr (fd/2) or stdout (fd/1) echo '2025/03/09 07:55:58 [emerg] 12345#0: unexpected "}" in /etc/nginx/nginx.conf:25' > /proc/1/fd/2 - Windows Activation (massgrave)
Activate Windows using the massgrave open-source script
irm https://massgrave.dev/get | iex - View WiFi Passwords
Retrieve saved WiFi passwords on Linux using NetworkManager
ls /etc/NetworkManager/system-connections/ sudo cat /etc/NetworkManager/system-connections/[network-name] nmcli device wifi list sudo nmcli connection show "" --show-secrets - Encrypt / Decrypt File with Password
Use OpenSSL AES-256-CBC with PBKDF2 to encrypt and decrypt files
# Encrypt echo "Este é um arquivo de teste" > original.txt openssl enc -aes-256-cbc -salt -pbkdf2 -in original.txt -out secreto.enc # Decrypt openssl enc -aes-256-cbc -d -salt -pbkdf2 -in secreto.enc # Decrypt from remote URL curl -s https://raw.githubusercontent.com/apolzek/apolzek.github.io/main/secreto.enc \ | openssl enc -aes-256-cbc -d -salt -pbkdf2 - Chrome Bookmarks (list all)
List all bookmarks from Chrome's JSON file showing name and URL
cat ~/.config/google-chrome/Default/Bookmarks \ | jq '.roots.bookmark_bar.children[] | {name: .name, url: .url}' - Linux Network Connections
View all saved NetworkManager connection configs
sudo cat /etc/NetworkManager/system-connections/*