On one of my servers, I created a subdomain called “uploads,” serving as a temporary spot for files I want to share or transfer. However, this directory keeps expanding uncontrollably. To manage it, I wrote a Bash script that will run directly or as a cron job to remove files that have overstayed their welcome, specified in the script in days.
(more…)Tag: bash
-
Extract subtitles from a movie file and save it as an .srt file using Bash
The film industry in Germany is definitely not Hollywood, but every now and then, there’s a movie that’s worth watching, e.g., “Glauben” (English: “The Allegation”) or “Terror” (“The Verdict”), both by the writer and lawyer Ferdinand von Schirach—that my non-German wife doesn’t understand.
Luckily, the German media libraries of public broadcast channels come with subtitles—in German, but those can be translated easily online if you extract the
(more…).srt
subtitle file from it. Here’s how. -
Simple Bash function to use md5sum for string input
Using macOS for most of my work, if I want to retrieve the hash of a string, macOS provides an easy
md5
function, located under/sbin/md5
and callable in any terminal:$ md5 -s 'Hey md5!'
Linux does things a little differently, but with a single line in Bash, you can keep the easy macOS syntax.
(more…)