You are not logged in.
This thread is for sharing pointless scrips that has no useful value at all, except for the fun or humor in it.
Here is my first contribution - The old and famous "Windows BLUE SCREEN OF DEATH"
bluescreen.sh
#!/bin/bash
# === BLUE SCREEN OF (NOT) DEATH ===
# Simulated BSOD for Linux nerds with humor ;)
# To quit just press Ctrl+C
# Hide cursor
tput civis
# Set terminal to blue background and white text
setterm -background blue -foreground white -clear
# Write "BSOD"-like text
echo -e "\n\n\n"
echo "A problem has been detected and your system has been shut down to prevent damage."
echo
echo "The problem seems to be caused by the following file: ext4.exe"
echo
echo "*** STOP: 0x00000F00 (0x00000000, 0x00000000, 0x00000000)"
echo "*** ext4.exe - KERNEL_SELF_REFERENCE_FAILURE"
echo
echo "Beginning dump of physical memory..."
# Simulated dump
for i in {1..100}; do
echo -ne "Dumping: $i%...\r"
sleep 0.05
done
echo -e "\n\nPhysical memory dump complete."
echo "Contact your system administrator or technical support group."
# Infinite loop – has to be stopped manually
while true; do
sleep 1
done
And for the Administrators: If this thread is more suitable in the Off Topic section, just move it there
[Edit: Just to make the Subject more clear and giving an introduction to what to post in this thread]
Last edited by close2zero (2025-08-04 23:05:55)
while true; do mount /dev/close2zero /mnt/clarity; done
Offline
...for the Administrators: If this thread is more suitable in the Off Topic section, just move it there
It's fine here IMO.
Pointless or not, it's still about scripting.
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
I have one more now, but it's still work in progress. I want to add more features because now it is only up and running. Here is a taste for those who are interested:
pong-pon.sh (the terminal emulator edition)
#!/bin/bash
###################################
# #
# Pong Pon for terminal emulators #
# #
###################################
clear
cat << "EOF"
██████╗ ██████╗ ███╗ ██╗ ██████╗
██╔══██╗██╔═══██╗████╗ ██║██╔════╝
██████╔╝██║ ██║██╔██╗ ██║██║ ███╗
██╔═══╝ ██║ ██║██║╚██╗██║██║ ██║
██║ ╚██████╔╝██║ ╚████║╚██████╔╝
╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝
██████╗ ██████╗ ███╗ ██╗
██╔══██╗██╔═══██╗ ████╗ ██║
██████╔╝██║ ██║ ██╔██╗ ██║
██╔═══╝ ██║ ██║ ██║╚██╗██║
██║ ╚██████╔╝ ██║ ╚████║
╚═╝ ╚═════╝ ╚═╝ ╚═══╝
┌──────────────────────────────────────────────┐
│ Choose Game Mode │
├──────────────────────────────────────────────┤
│ 1. Two Player (Left: w/s Right: o/l) │
│ 2. One Player (You: w/s Opponent: AI) │
└──────────────────────────────────────────────┘
EOF
read -rp $'Choose Game Mode (1 or 2): ' choice
case "$choice" in
1) msg="Starting Pong – Two Player Mode..." ; mode="pong-two-player.sh" ;;
2) msg="Starting Pong – One Player Mode..." ; mode="pong-ai.sh" ;;
*) echo "Invalid choice."; exit 1 ;;
esac
echo -e "$msg"
echo -n "Loading game "
# Classic spinner animation
spinner="/-\\|"
for i in {1..12}; do
i=$((i % 4))
printf "\b${spinner:$i:1}"
sleep 0.2
done
BIN="$HOME/bin/$mode"
mkdir -p "$HOME/bin"
if [[ "$mode" == "pong-two-player.sh" ]]; then
cat > "$BIN" << 'EOF'
#!/bin/bash
# === CONFIGURATION ===
HEIGHT=24
WIDTH=80
PADDLE_HEIGHT=4
BALL_CHAR="o"
PADDLE_CHAR="|"
DELAY=0.02
# === INITIAL POSITIONS ===
paddle1_y=10
paddle2_y=10
ball_x=$((WIDTH / 2))
ball_y=$((HEIGHT / 2))
ball_dx=-1 # Always start toward player 1
ball_dy=1
# === TERMINAL SETUP ===
stty -echo -icanon time 0 min 0
tput civis
clear
# === CLEANUP ON EXIT ===
cleanup() {
tput cnorm
stty sane
clear
exit
}
trap cleanup INT TERM
# === DRAW FUNCTION (BUFFERED) ===
draw() {
screen_buffer=""
for ((y=0; y<HEIGHT; y++)); do
line=""
for ((x=0; x<WIDTH; x++)); do
if ((x == 1 && y >= paddle1_y && y < paddle1_y + PADDLE_HEIGHT)); then
line+="$PADDLE_CHAR"
elif ((x == WIDTH - 2 && y >= paddle2_y && y < paddle2_y + PADDLE_HEIGHT)); then
line+="$PADDLE_CHAR"
elif ((x == ball_x && y == ball_y)); then
line+="$BALL_CHAR"
else
line+=" "
fi
done
screen_buffer+="$line\n"
done
echo -en "$screen_buffer"
}
# === MAIN GAME LOOP ===
while true; do
# PLAYER INPUT
if read -rsn1 -t "$DELAY" key; then
case "$key" in
w|W) ((paddle1_y > 1)) && ((paddle1_y--)) ;;
s|S) ((paddle1_y + PADDLE_HEIGHT < HEIGHT - 1)) && ((paddle1_y++)) ;;
o|O) ((paddle2_y > 1)) && ((paddle2_y--)) ;;
l|L) ((paddle2_y + PADDLE_HEIGHT < HEIGHT - 1)) && ((paddle2_y++)) ;;
q|Q) cleanup ;;
esac
fi
# BALL MOVEMENT
((ball_x += ball_dx))
((ball_y += ball_dy))
if ((ball_y <= 0 || ball_y >= HEIGHT - 1)); then
((ball_dy *= -1))
fi
# COLLISION WITH LEFT PADDLE
if ((ball_x == 2)); then
if ((ball_y >= paddle1_y && ball_y < paddle1_y + PADDLE_HEIGHT)); then
((ball_dx *= -1))
fi
fi
# COLLISION WITH RIGHT PADDLE
if ((ball_x == WIDTH - 3)); then
if ((ball_y >= paddle2_y && ball_y < paddle2_y + PADDLE_HEIGHT)); then
((ball_dx *= -1))
fi
fi
# OUT OF BOUNDS – RESET BALL
if ((ball_x <= 0 || ball_x >= WIDTH - 1)); then
ball_x=$((WIDTH / 2))
ball_y=$((HEIGHT / 2))
ball_dx=-1
ball_dy=$((RANDOM % 2 == 0 ? 1 : -1))
fi
# RENDER FRAME
draw
done
EOF
else
cat > "$BIN" << 'EOF'
#!/bin/bash
# === CONFIGURATION ===
HEIGHT=24
WIDTH=80
PADDLE_HEIGHT=4
BALL_CHAR="o"
PADDLE_CHAR="|"
DELAY=0.02
# === INITIAL POSITIONS ===
paddle1_y=10
paddle2_y=10
ball_x=$((WIDTH / 2))
ball_y=$((HEIGHT / 2))
ball_dx=-1 # Always start toward the player at game start
ball_dy=1
ai_target_y=10
prev_ball_dx=$ball_dx
ai_reaction_delay=5
ai_reaction_counter=0
# === TERMINAL SETUP ===
stty -echo -icanon time 0 min 0
tput civis
clear
# === CLEANUP ON EXIT ===
cleanup() {
tput cnorm
stty sane
clear
exit
}
trap cleanup INT TERM
# === AI PREDICTION FUNCTION ===
predict_ball_target_y() {
local sim_x=$ball_x
local sim_y=$ball_y
local dx=$ball_dx
local dy=$ball_dy
while ((sim_x < WIDTH - 3)); do
((sim_x += dx))
((sim_y += dy))
if ((sim_y <= 0 || sim_y >= HEIGHT - 1)); then
((dy *= -1))
fi
done
local offset=$(( (RANDOM % 3) - 1 ))
sim_y=$((sim_y + offset))
if ((sim_y < 1)); then sim_y=1; fi
if ((sim_y > HEIGHT - PADDLE_HEIGHT)); then
sim_y=$((HEIGHT - PADDLE_HEIGHT))
fi
echo "$sim_y"
}
# === DRAW FUNCTION (BUFFERED) ===
draw() {
screen_buffer=""
for ((y=0; y<HEIGHT; y++)); do
line=""
for ((x=0; x<WIDTH; x++)); do
if ((x == 1 && y >= paddle1_y && y < paddle1_y + PADDLE_HEIGHT)); then
line+="$PADDLE_CHAR"
elif ((x == WIDTH - 2 && y >= paddle2_y && y < paddle2_y + PADDLE_HEIGHT)); then
line+="$PADDLE_CHAR"
elif ((x == ball_x && y == ball_y)); then
line+="$BALL_CHAR"
else
line+=" "
fi
done
screen_buffer+="$line\n"
done
echo -en "$screen_buffer"
}
# === MAIN GAME LOOP ===
while true; do
if read -rsn1 -t "$DELAY" key; then
case "$key" in
w|W) ((paddle1_y > 1)) && ((paddle1_y--)) ;;
s|S) ((paddle1_y + PADDLE_HEIGHT < HEIGHT - 1)) && ((paddle1_y++)) ;;
q|Q) cleanup ;;
esac
fi
if ((ball_dx == 1 && prev_ball_dx != 1)); then
ai_reaction_counter=$ai_reaction_delay
fi
prev_ball_dx=$ball_dx
if ((ai_reaction_counter > 0)); then
((ai_reaction_counter--))
if ((ai_reaction_counter == 0)); then
ai_target_y=$(predict_ball_target_y)
fi
fi
if ((ball_dx == 1 && ball_x < WIDTH * 3 / 4)); then
if ((RANDOM % 4 == 0)); then
if ((RANDOM % 2 == 0 && paddle2_y > 1)); then
((paddle2_y--))
elif ((paddle2_y + PADDLE_HEIGHT < HEIGHT - 1)); then
((paddle2_y++))
fi
fi
elif ((ai_reaction_counter == 0)); then
ai_center=$((paddle2_y + PADDLE_HEIGHT / 2))
if ((ai_center < ai_target_y)); then
((paddle2_y++))
elif ((ai_center > ai_target_y)); then
((paddle2_y--))
fi
fi
if ((paddle2_y < 1)); then paddle2_y=1; fi
if ((paddle2_y + PADDLE_HEIGHT > HEIGHT - 1)); then
paddle2_y=$((HEIGHT - 1 - PADDLE_HEIGHT))
fi
((ball_x += ball_dx))
((ball_y += ball_dy))
if ((ball_y <= 0 || ball_y >= HEIGHT - 1)); then
((ball_dy *= -1))
fi
if ((ball_x == 2)); then
if ((ball_y >= paddle1_y && ball_y < paddle1_y + PADDLE_HEIGHT)); then
((ball_dx *= -1))
fi
fi
if ((ball_x == WIDTH - 3)); then
if ((ball_y >= paddle2_y && ball_y < paddle2_y + PADDLE_HEIGHT)); then
((ball_dx *= -1))
fi
fi
if ((ball_x <= 0 || ball_x >= WIDTH - 1)); then
ball_x=$((WIDTH / 2))
ball_y=$((HEIGHT / 2))
ball_dx=-1
ball_dy=$((RANDOM % 2 == 0 ? 1 : -1))
ai_target_y=$paddle2_y
ai_reaction_counter=0
prev_ball_dx=$ball_dx
fi
draw
done
EOF
fi
chmod +x "$BIN"
"$BIN"
rm -f "$BIN"
exit 0
Enjoy..
[Edit:]
Just misplaced the end of code and had to move it to the right place
Last edited by close2zero (2025-08-05 12:57:48)
while true; do mount /dev/close2zero /mnt/clarity; done
Offline