• Oct 2, 2026 •LeifMessinger
0 likes • 3 views
#!/usr/bin/env bash #Also pure vibecoded slop. Never tested. Ever. set -euo pipefail if [ $# -lt 1 ]; then echo "Usage: $0 <python_script.py> [--dryrun]" exit 1 fi TARGET="$1" DRYRUN=false if [[ "${2:-}" == "--dryrun" ]]; then DRYRUN=true fi OUTDIR="clean" CWD="$(pwd)" echo "=== Bash Trace Collector ===" echo "Script: $TARGET" echo "CWD: $CWD" echo "DryRun: $DRYRUN" echo # Run trace TRACE_OUTPUT=$(python -m trace --trackcalls "$TARGET" 2>&1) # Extract .py paths (Windows, Unix, mixed) echo "$TRACE_OUTPUT" \ | grep -Eo '([A-Za-z]:[\\/][^*<>"]+\.py)|(/[A-Za-z0-9._/-]+\.py)|(\.[/\\][^*<>"]+\.py)' \ | sort -u \ | while read -r FILE; do # Normalize slashes FILE="${FILE//\\//}" # Skip frozen modules if [[ "$FILE" == "<frozen"* ]]; then continue fi # Only keep files inside the current working directory if [[ "$FILE" == "$CWD"* ]]; then # Compute relative path REL="${FILE#$CWD/}" DEST="$OUTDIR/$REL" DESTDIR="$(dirname "$DEST")" if $DRYRUN; then echo "[WOULD COPY] $FILE --> $DEST" else mkdir -p "$DESTDIR" echo "[COPYING] $FILE" cp "$FILE" "$DEST" fi else echo "[IGNORED: outside CWD] $FILE" fi done echo echo "=== DONE ===" if $DRYRUN; then echo "Dry run complete. No files were copied." else echo "Files copied to '$OUTDIR' with preserved relative paths." fi
• Oct 26, 2021 •LeifMessinger
0 likes • 5 views
#!/bin/bash #Leif Messinger lsm0147 #credit.sh FILES cred="Leif Messinger lsm0147" for bruh; do if [[ $bruh =~ \.cpp|\.c|\.java|\.js ]]; then comment="//$cred" else #Basically everything else gets a pound sign comment #Pound signs are standard across linux. bash, sed, gawk, python etc #Speaking of which, I need to escape it because of that. comment="\#$cred" fi if [ -s $bruh ]; then #If the file has a shebang if egrep -q '^#!/' $bruh; then sed -i "/^\#!\//a$comment" $bruh else sed -i "1i$comment" $bruh fi else echo "$comment" > $bruh fi done
• Mar 20, 2023 •C S
0 likes • 1 view
// check version node -v || node --version // list installed versions of node (via nvm) nvm ls // install specific version of node nvm install 6.9.2 // set default version of node nvm alias default 6.9.2 // switch version of node nvm use 6.9.1
• Nov 14, 2021 •LeifMessinger
0 likes • 7 views
#!/bin/bash #Takes all the c and h files in the current directory and prints them #Yup, it's that easy for file in *.h *.hpp *.c *.cpp; do #If it exists if [ -f "$file" ]; then echo "//===============$file===============" cat $file fi done
• Nov 17, 2021 •LeifMessinger
0 likes • 8 views
#!/bin/bash #Takes command line arguments and pulls the header files. #Good for checking if the function you want is in the header or not. #cppToStdout.sh "time.h" while [ "$1" != "" ]; do echo "#include<$1>" | g++ -x c++ -E - shift done
• Apr 21, 2021 •LeifMessinger
#diskRipper.sh by Leif Messinger #For use on debian, where your cds aren't immediately mounted wall "CD inserted boss" set -x #echo on cdDrivePath=$(ls -l /dev/cdrom | awk '{print $NF}') #CD could have no label, so that's why I need awk cdLabel=$(lsblk -n "/dev/$cdDrivePath" -o label) if [[ ! -z "$cdLabel" ]]; then #CD has label folderName=$cdLabel echo "The cd label is ${folderName}" if mkdir ./cds/"${folderName}"; then #Folder didn't exist before sudo mount /dev/cdrom ./.cdmountpoint sudo cp -r ./.cdmountpoint/* "./cds/${folderName}" sudo chmod -R 777 "./cds/${folderName}" sudo umount ./.cdmountpoint eject wall "CD done and ejecting" else wall "Already read that cd, skipped" fi else wall "CD had no label, skipped" fi