dotfiles/scripts/serveit
rpriven 5b6af65def
Organize scripts and clean up dotfiles
Changes:
- Added 80+ scripts with organized structure
  - payloads/ for third-party pentesting tools
  - pentesting/ for custom security scripts
  - Daily drivers remain flat for fast access
- Converted wes() function to proper script
- Removed .sh extensions from pentesting scripts
- Cleaned up aliases (removed 31 redundant lines)
- Added kanata/, build artifacts to gitignore
- Removed old fre.sh scripts and empty a.out
- Updated configs: helix, tmux, zsh, ulauncher, redshift

Security: All sensitive data excluded via gitignore
2025-11-07 14:48:21 -07:00

30 lines
810 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
# Script Name: serveit
# Description: Quick static file server on localhost
# Source: https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/
# Usage: serveit [port] # defaults to 8000
port='8000'
if [[ $# -eq 1 ]]; then
port="$1"
fi
if hash php 2>/dev/null; then
exec php -S "localhost:$port"
elif hash python3 2>/dev/null; then
exec python3 -m http.server "$port"
elif hash python 2>/dev/null; then
major_version="$(python -c 'import platform as p;print(p.python_version_tuple()[0])')"
if [[ "$major_version" == '3' ]]; then
exec python -m http.server "$port"
else
exec python -m SimpleHTTPServer "$port"
fi
elif hash ruby 2>/dev/null; then
exec ruby -run -e httpd . -p "$port"
else
echo 'unable to start HTTP server' >&2
exit 1
fi