Skip to content

Instantly share code, notes, and snippets.

View megahall's full-sized avatar

Matthew Hall megahall

  • MV Security, LLC
  • San Jose, CA
View GitHub Profile
@megahall
megahall / fix-home.bash
Last active July 3, 2026 02:47
maked home subdirectories on Debian work like the ones on Ubuntu and Kubuntu
#!/bin/bash
sudo aptitude install xdg-user-dirs xdg-user-dirs-gtk
xdg-user-dirs-update --force
xdg-user-dirs-gtk-update
rm -r ~/.local/share/user-places.xbel*
sudo systemctl restart sddm
@megahall
megahall / update-codex.bash
Created June 17, 2026 19:23
simple script to update Codex in CWD
#!/bin/bash
script_directory="$(dirname "$(realpath "${BASH_SOURCE[0]}")")"
cd "${script_directory}"
version="${1:-0.140.0}"
wget -O "codex-npm-linux-x64-${version}.tgz" "https://github.com/openai/codex/releases/download/rust-v${version}/codex-package-x86_64-unknown-linux-musl.tar.gz"
tar xzf "codex-npm-linux-x64-${version}.tgz" bin/codex
mv bin/codex codex
@megahall
megahall / ssh.bash
Last active December 21, 2024 09:14
how to detect brute force SSH connections in a short time window, and apply the ban for a long time window
#!/bin/bash
count="3"
window="60"
length="300"
ip_mask="255.255.255.0"
ip6_mask="ffff:ffff:ffff:ffff::"
iptables -A INPUT -p tcp --dport 22 \
@megahall
megahall / watermark.bash
Created October 23, 2024 19:01
Watermark Your PDF With A Specific String In Linux
#!/bin/bash
watermark="${1}"
shift
wm_pdf="$(mktemp -t watermark_XXXXXX.pdf)"
convert -background none -fill "rgba(128, 128, 128, 0.7)" -gravity center -font Arial -pointsize 96 "label:${watermark}" -bordercolor none -border 10x10 "${wm_pdf}"
for input in "$@"; do
@megahall
megahall / .pythonrc
Last active November 11, 2015 23:24
# export PYTHONSTARTUP=~/.pythonrc
import atexit
import base64
import binascii
import json
import os
import re
import socket
import string
@megahall
megahall / ovftool-esxi-deploy.bash
Created October 21, 2015 01:52
deploys OVA files onto ESXi with high performance
#!/bin/bash
set -e -x
images=$(ls some_directories/*.ova)
suffix="test_A"
for image in ${images}; do
image_name=$(basename "${image}" ".ova")
count=1