Restructure repository: organize tools by purpose, create what search tool

- Move single-file tools to tools/ organized by category (security, forensics, data, etc.)
- Move multi-file projects to projects/ (go-tools, puzzlebox, timesketch, rust-tools)
- Move system scripts to scripts/ (proxy, display, setup, windows)
- Organize config files in config/ (shell, visidata, applications)
- Move experimental tools to archive/experimental
- Create 'what' fuzzy search tool with progressive enhancement (ollama->fzf->grep)
- Add initial metadata database for intelligent tool discovery
- Preserve git history using 'git mv' commands
This commit is contained in:
tobias
2025-08-24 19:50:00 +02:00
parent 9518290544
commit 619b0bc432
124 changed files with 1063 additions and 0 deletions

59
tools/formats/convert2pdf.sh Executable file
View File

@@ -0,0 +1,59 @@
#!/bin/bash
# Check if a file argument is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <file-to-convert>"
exit 1
fi
# Assign the file argument to a variable
FILE_TO_CONVERT=$1
FILE_NAME=$(basename "$FILE_TO_CONVERT")
# Define the Gotenberg Docker image
GOTENBERG_IMAGE="gotenberg/gotenberg:8"
# Start the Gotenberg Docker container in the background
docker run --rm -d -p 3000:3000 --name gotenberg $GOTENBERG_IMAGE
# Function to stop the Docker container
function stop_container {
docker stop gotenberg
}
# Register the stop_container function to be called on script exit
trap stop_container EXIT
# Wait for a moment to ensure that the container is up and running
sleep 3
# Determine the correct API endpoint based on the file extension
EXTENSION="${FILE_TO_CONVERT##*.}"
API_ENDPOINT="/forms/libreoffice/convert"
# Special handling for HTML files to use Chromium conversion
if [ "$EXTENSION" == "html" ]; then
API_ENDPOINT="/forms/chromium/convert/html"
# Ensure the HTML file is named index.html
if [ "$FILE_NAME" != "index.html" ]; then
echo "Renaming $FILE_NAME to index.html for conversion"
cp "$FILE_TO_CONVERT" "/tmp/index.html"
FILE_TO_CONVERT="/tmp/index.html"
fi
fi
# Convert the file to PDF using the Gotenberg API
curl --request POST \
--url http://localhost:3000$API_ENDPOINT \
--header 'Content-Type: multipart/form-data' \
--form files=@"$FILE_TO_CONVERT" \
-o converted.pdf
# Check if the conversion was successful
if [ ! -f converted.pdf ]; then
echo "Failed to convert the file to PDF."
exit 3
fi
# Display the PDF with Evince
evince converted.pdf &

16
tools/formats/flatpdf.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
if ! which zathura 1>/dev/null 2>&1 ; then
echo "zathura pdf viewer not found"
echo "sudo apt install zathura"
exit 1
fi
if ! which docker 1>/dev/null 2>&1 ; then
echo "docker not found"
echo "sudo apt install docker.io"
exit 1
fi
if [[ -f "${1}" ]] ; then
cat "${1}" | docker run -i --rm tabledevil/flatpdf | zathura -
fi

13
tools/formats/rename.mime.py Executable file
View File

@@ -0,0 +1,13 @@
import os
import sys
import subprocess
import re
pattern=re.compile("(: )([^;]+)")
for file in os.listdir(sys.argv[1]):
output=subprocess.check_output(["file","-Ni",file])
match=pattern.search(output)
mimetype=re.sub(r"\W","_",match.group(2))
if not os.path.exists(mimetype):
os.makedirs(mimetype)
os.rename(file,mimetype+os.sep+file)