💾 Archived View for twentytwo.town › ~rooney › scripts.gmi captured on 2024-12-17 at 11:31:00. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-08-31)

-=-=-=-=-=-=-

Silly little bash scripts I use on desktop

I figured I would toss some very smol scripts that I use often enough on *nix machines here. These are pretty silly/mostly not used for work or anything like that, but you may find them uselful enough. I will add more here as they are created. Most of these live at this github repo currently:

my random linux scripts repository

------------------------

echo "How many characters do you want in your string?" 

read strlen

echo "Include special characters? [y/n]"

read char
if [[ $char == y ]]; then
   cat /dev/urandom | tr -dc 'a-zA-Z0-9~@#$%^&*()-_=+[{]}\:;<,>.?/' | fold -w $strlen | head -n 1
else
   cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $strlen | head -n 1
fi

spoofed MAC addresses and so on:

sudo nmap -sP 192.168.1.0/24 | awk '/^Nmap/{ip=$NF}/B8:27:EB/{print ip}'
while true;
do
    temp=$(</sys/class/thermal/thermal_zone0/temp);
    echo "$((temp/1000)) c";
    sleep  1;
done
echo "How many dice do you want to roll?"

read rolls
printf "~~~~~~~~~~~~~~~~\nRolling bones...\n~~~~~~~~~~~~~~~~\n"

for i in $(seq $rolls)
do
  tr -cd '1-6' < /dev/urandom | head -c 1; echo
done

import glob
import random
import subprocess

files = glob.glob('/media/**/*.mp4') + glob.glob('/media/**/*.mkv') + glob.glob('/media/**/*.avi')

play = random.choice(files)
subprocess.run(["vlc", play, "–fullscreen"])

read -e -p "Enter the directory path: " directory
if [ ! -d "$directory" ]; then
  echo "Directory does not exist."
  exit 1
fi

for file in "$directory"/*; do
  # Check against common video file extensions
  if [[ -f "$file" && ( "$file" =~ \.mp4$ || "$file" =~ \.mkv$ || "$file" =~ \.avi$ ) ]]; then
    # Use ffprobe to check each file's integrity
    ffprobe -v error -show_format -show_streams "$file" > /dev/null 2>&1

    # Check the exit status of ffprobe to determine if each file is corrupt or incomplete
    if [ $? -ne 0 ]; then
      echo "Corrupted or incomplete file: $file"
    fi
  fi
done