Skip to content

Category: Shell

What is my ip address?

Another “what is my ip address” app.

So far I have 2 apps for telling you your IP address.

One can be found here, https://yourip.sh. This is using GO and was forked from ifconfig.io. I wanted to learn GO so I forked that project and made modifications to it.

Such as…

  • Added MaxMind databases
  • Added dark mode
  • Added the ability to add other HTML elements
  • Added integration with plausible analytics

https://github.com/xavier-hernandez/yourip.sh

My other, older, app can be found here https://whatismyip.biz . This app is built in .NET, Blazor client side, running on a Linux server. This is totally custom built.

Both apps above a are docker images that I’ve created as well.

Leave a Comment

bash script to clean up directories

#!/bin/bash
# Define the directory to search (you can change this to the desired directory)
DIR="/temp"

# Array of file extensions to delete
EXTENSIONS=("*.txt" "*.srt" "*.nzb" "*.sup" "*.ac3" "*.dts" "*.sample.*" "*.srr")

# Counters for deleted files and directories
deleted_files=0
deleted_directories=0

# Loop through the array and delete the files, counting each deletion
for EXT in "${EXTENSIONS[@]}"; do
    count=$(find "$DIR" -type f -name "$EXT" -print -delete | wc -l)
    deleted_files=$((deleted_files + count))
done

# Find and delete empty directories, counting each deletion
count=$(find "$DIR" -type d -empty -print -delete | wc -l)
deleted_directories=$((deleted_directories + count))

# Output the counts
echo "Deleted $deleted_files files with extensions ${EXTENSIONS[*]}."
echo "Deleted $deleted_directories empty directories."

For the most up-to-date version, follow the links below.

https://snippets.cacher.io/snippet/b554e570d8ffc0431ad9

https://gist.github.com/xavier-hernandez/f4979b4ce174068ce5428a26ae08be32

Leave a Comment