Files
docker_file_analysis/scripts/add-tool-cheats.sh
Tobias Kessels b98aaee3e0 Major repository cleanup and enhancement
- Reorganize documentation: moved old docs to docs/ directory
- Add comprehensive README.md with build options and usage guide
- Add detailed CONTRIBUTING.md with help content management guide
- Create Makefile for automated building and testing
- Add Dockerfile.scratch for building from Ubuntu 20.04 base
- Enhance all Dockerfiles with PowerShell + PSScriptAnalyzer
- Add modern shells: zsh (with plugins) and fish (with config)
- Add modern CLI tools: fd-find, ripgrep, fzf
- Create comprehensive help system with cheat/TLDR/fish completions
- Add helper scripts for help content management and coverage checking
- Fix Dockerfile.remnux script references
- Support three build variants: upstream (REMnux), scratch (Ubuntu), kali

Build options:
  - make build-upstream: Fast, uses REMnux upstream (recommended)
  - make build-scratch: Full control, builds from Ubuntu 20.04
  - make build-kali: Legacy Kali Linux base

Features:
  - PowerShell with PSScriptAnalyzer module
  - Modern shells (zsh, fish) with custom configurations
  - Enhanced help system (cheat sheets, TLDR pages, fish completions)
  - Help coverage checking and bulk import tools
  - Comprehensive documentation for users and contributors
2025-10-01 11:45:56 +02:00

173 lines
3.3 KiB
Bash
Executable File

#!/bin/bash
# Add cheat sheets for fd-find, ripgrep, zsh, fish
CHEAT_DIR="/opt/cheatsheets/personal"
mkdir -p "$CHEAT_DIR"
# fd-find cheat sheet
cat > "$CHEAT_DIR/fd" << 'EOF'
# fd (fdfind) - Fast and user-friendly alternative to find
# Find files by name
fdfind pattern
# Find in specific directory
fdfind pattern /path/to/search
# Find only files (no directories)
fdfind -t f pattern
# Find only directories
fdfind -t d pattern
# Case-insensitive search
fdfind -i PDF
# Include hidden and ignored files
fdfind -H pattern
# Execute command on results
fdfind pattern -x rm
# Find and show absolute paths
fdfind -a pattern
# Find files modified in last 24 hours
fdfind -t f --changed-within 24h
# Find PDF files in current directory
fdfind -e pdf
# Exclude directories from search
fdfind pattern -E node_modules -E vendor
EOF
# ripgrep cheat sheet
cat > "$CHEAT_DIR/rg" << 'EOF'
# ripgrep (rg) - Fast recursive grep alternative
# Basic search
rg pattern
# Case-insensitive search
rg -i pattern
# Search specific file types
rg -t py pattern
rg -t js pattern
# Search in specific files
rg pattern -g '*.pdf'
# Show context (3 lines before/after)
rg -C 3 pattern
# Show only filenames with matches
rg -l pattern
# Count matches per file
rg -c pattern
# Search for exact word
rg -w word
# Search hidden files
rg --hidden pattern
# Search compressed files
rg -z pattern file.gz
# Find URLs in files
rg 'https?://[^\s]+'
# Find suspicious JavaScript in PDFs
rg -i 'javascript|openaction' -g '*.pdf'
# Search with file types excluded
rg pattern --type-not python
# Multiline search
rg -U 'pattern1.*pattern2'
EOF
# ripgrep alias
cp "$CHEAT_DIR/rg" "$CHEAT_DIR/ripgrep"
# zsh cheat sheet
cat > "$CHEAT_DIR/zsh" << 'EOF'
# zsh - Z Shell with powerful features
# Start zsh
zsh
# Set zsh as default shell
chsh -s $(which zsh)
# Autocompletion
# Type command and press TAB
# History search
# Type start of command and press UP arrow
# Directory stack
dirs -v # Show directory stack
pushd /path # Push directory and cd
popd # Pop and return to previous
# Glob patterns
ls **/*.pdf # Recursive glob
ls *.pdf~*.bak # Exclude pattern
# Aliases (already configured in container)
ll # ls -lah
fd # fdfind
analyse # fhelp
? # fhelp
# History commands
history # Show all history
history 10 # Show last 10
!$ # Last argument of previous command
!! # Repeat last command
EOF
# fish cheat sheet
cat > "$CHEAT_DIR/fish" << 'EOF'
# fish - Friendly Interactive Shell
# Start fish
fish
# Set fish as default shell
chsh -s $(which fish)
# Autocompletion
# Type command and press TAB (shows suggestions automatically)
# History search
# Type start of command and see suggestions
# Press RIGHT arrow to accept
# Command abbreviations
abbr --add gco git checkout
abbr --list
abbr --erase gco
# Functions (instead of aliases)
function ll
ls -lah $argv
end
funcsave ll # Save function permanently
# Environment variables
set -x PATH /new/path $PATH # Export
set -e VARIABLE # Erase
# Configuration
fish_config # Open web-based configuration
# Plugins (fisher)
# curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
EOF
echo "✅ Added cheat sheets for fd, ripgrep, zsh, fish"