Skip to content

Instantly share code, notes, and snippets.

@mrrootsec
Last active July 11, 2026 10:23
Show Gist options
  • Select an option

  • Save mrrootsec/bc355ebcdc6ede1d3aa9624635fcc7a9 to your computer and use it in GitHub Desktop.

Select an option

Save mrrootsec/bc355ebcdc6ede1d3aa9624635fcc7a9 to your computer and use it in GitHub Desktop.
cheatsheet of few handy command

Remove recently installed packages via apt - Ubuntu

awk -v d="$(date '+%Y-%m-%d')" '$0 ~ "Start-Date: " d {p=1} p && /Commandline: apt install/ {for(i=3;i<=NF;i++) if($i !~ /^-/) printf "%s ", $i; print ""} /^$/ {p=0}' /var/log/apt/history.log | xargs -r sudo apt remove -y

Bash alias

pyserve() {
    local port="${1:-8000}"
    local ip
    ip=$(curl -fsS https://ifconfig.me || echo "Unknown")

    echo "Serving: http://$ip:$port"
    echo "Press Ctrl+C to stop."
    python3 -m http.server "$port"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment