/usr/bin/rm -rf xfilelist for i in `ls -1 *.mov`; do echo "file $i" >> xfilelist done ffmpeg -safe 0 -f concat -i xfilelist -vcodec copy -acodec copy $1.mov
2022-07-17
Matrox Monarch 5-minute video recordings assembled for Youtube.
This is a short bash scirpt I used to compose 5-minute mov files
into one mpg file to upload to Youtube. We have a Matrox Monarch
that records locally to flash drive, and the 5-minute videos must
be put together later, if we don't stream directly to Youtube.
2022-07-16
Various scripts to delete unnecessary odd characters from file names and directory/folder names
These are short bash scripts I wrote to delete characters mostly from MP3, JPG, MP4, and DOC/TXT filenames ------------- del-2dash ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | egrep "\-\-") do mv -v $xdir ${xdir//--/-} echo $xdir done for file in $(find . -type f | egrep "\-\-") do mv -v $file ${file//--/-} echo $file done ------------- ------------- del-ampersand ------------- IFS=$(echo -en "\n\b") for xfile in $(find . -type d) do echo $xfile | grep "\&" && { echo changing $xfile; mv -v "$xfile" ${xfile//\&/And} } done for xfile in $(find . -type f) do echo $xfile | grep "\&" && { echo changing $xfile; mv -v "$xfile" ${xfile//\&/And} } done ------------- ------------- del-comma ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | grep ",") do mv -v $xdir ${xdir//,/-} echo $xdir done for file in $(find . -type f | grep ",") do mv -v $file ${file//,/-} echo $file done ------------- ------------- del-dashdot ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | egrep "\-\.") do mv -v $xdir ${xdir//-./.} echo $xdir done for file in $(find . -type f | egrep "\-\.") do mv -v $file ${file//-./.} echo $file done ------------- ------------- del-dothtm ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | grep ".htm.") do mv -v $xdir ${xdir//.htm./.} echo $xdir done for file in $(find . -type f | grep ".htm.") do mv -v $file ${file//.htm./.} echo $file done ------------- ------------- del-fnspaces ------------- IFS=$(echo -en "\n\b") mv -v $1 ${1// /} ------------- ------------- del-mp3s ------------- IFS=$(echo -en "\n\b") for file in $(find . -type f | grep "\.MP3-mono\.mp3") do mv -v $file ${file//\.MP3-mono\.mp3/\.mp3} done for file in $(find . -type f | grep "\.mp3-mono\.mp3") do mv -v $file ${file//\.mp3-mono\.mp3/\.mp3} done for file in $(find . -type f | grep "\.wav-mono\.wav") do mv -v $file ${file//\.wav-mono\.mp3/\.mp3} done for file in $(find . -type f | grep "\.WAV-mono\.wav") do mv -v $file ${file//\.WAV-mono\.mp3/\.mp3} done ------------- ------------- del-offical ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | grep -i "official") do mv -v $xdir ${xdir//OfficialAudio/} mv -v $xdir ${xdir//OfficialAudio/} echo $xdir done for file in $(find . -type f | grep -i "official") do mv -v $file ${file//OfficialAudio/} mv -v $file ${file//OfficialAudio/} echo $file done ------------- ------------- del-offical2 ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | grep -i "official") do mv -v $xdir ${xdir//OfficialAudio/} mv -v $xdir ${xdir//OfficialAudio/} echo $xdir done for file in $(find . -type f | grep -i "official") do mv -v $file ${file//officialaudio/} mv -v $file ${file//officialaudio/} echo $file done ------------- ------------- del-paren ------------- IFS=$(echo -en "\n\b") for file in $(find . -type f) do mv -v $file ${file//\(/} 2>> /dev/null done for file in $(find . -type f) do mv -v $file ${file//\)/} 2>> /dev/null done ------------- ------------- del-periods ------------- IFS=$(echo -en "\n\b") for file in $(find . -type d | grep ".") do echo $file mv -v $file ${file//./} done ------------- ------------- del-singlequote ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d) do echo $xdir | grep "'" && { echo changing $xdir; mv -v "$xdir" "${xdir//\'/And}" } done for xfile in $(find . -type f) do echo $xfile | grep "'" && { echo changing $xfile; mv -v "$xfile" "${xfile//\'/And}" } done ------------- ------------- del-spaces ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | grep " ") do mv -v $xdir ${xdir// /} done for xfile in $(find . -type f | grep " ") do mv -v $xfile ${xfile// /} done ------------- ------------- del-sqbracket ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | grep "\[") do mv -v $xdir ${xdir//\[/-} echo $xdir done for file in $(find . -type f | grep "\[") do mv -v $file ${file//\[/-} echo $file done ------------- ------------- del-sqbracket2 ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | egrep "\]") do mv -v $xdir ${xdir//\]/} echo $xdir done for file in $(find . -type f | egrep "\]") do mv -v $file ${file//\]/} echo $file done ------------- ------------- del-sync-conflicts ------------- #!/usr/bin/bash IFS=$(echo -en "\n\b") for file in $(find . -type f | grep "sync\-conflict\-") do echo "$file" rm -rf "$file" done ------------- ------------- del-underscores ------------- IFS=$(echo -en "\n\b") for xdir in $(find . -type d | grep "_") do mv -v $xdir ${xdir//_/-} echo $xdir done for file in $(find . -type f | grep "_") do mv -v $file ${file//_/-} echo $file done -------------
Linux Perl script to run to monitor load average and send an a lert
#!/usr/bin/perl $load = `/usr/bin/uptime`; $load =~ /\s+load average:\s+(\S+),\s+/; #print $1, "\n"; $me = `/bin/hostname`; $load = $1; if ($load > 5.5) { #system("/usr/bin/logger -p daemon.emerg load-ave-alert load $load."); system("/usr/bin/wall load-ave-alert load $load."); $DATE = `/bin/date +'%Y%m%d%H%M'`; open(DOMAIL,"| /bin/mail -s \"load-ave-alert $me load high\" root"); print DOMAIL "$me load is $load at $DATE"; close(DOMAIL); } exit; # It seems likely with all the restrictrions on email servers due to spam, that # the email would work only locally on the Linux system # This script could be fork with more perl scripting on with the "nohup" command # ============================================= #!/usr/bin/bash # bash script to fork the perl script above echo $* (/usr/bin/nohup $* > /tmp/nohup$$.txt &)& ================================================== # you could this for the perl script to fork itself after the first line #!/usr/bin/perl $dofork = 1; if ($dofork) { if (open(PS, "/bin/ps ax | /bin/grep \"ping2failure $target\" | /bin/grep -v gre p |")) { @psax =; close(PS); #print "@psax"; for(@psax) { s/^\s+//g; #print $_; if (/ping2failure $target/) { #print "$_"; ($pid, @stuff) = split(/\s+/); #print "$$ pid is $pid and $stuff[0]\n"; if ($pid != $$) { die "$target already being waited on\n"; # no reason to run if already doing this } } } } # deal with stdin, stdout, stderr, control terminal, and put self # in background $TIOCNOTTY = 0x20007471; close(stdin); open(stdout, ">/dev/null"); open(stderr, ">/dev/null"); if (open(tty, "/dev/tty")) { ioctl(tty, $TIOCNOTTY, 0); close(tty); } if (fork) { exit 0; } }
2022-07-15
Unable to set a default app - no "always use this app to open"
Thanks to Microsoft for making Windows 11 nearly impossible to set your favorite apps or programs to enjoy your own media like pictures, music, mp3's, podcasts, even text files. You must use regedit to search registry for the "NoOpenWith" variable and delete this string within the appropriate context.
For example, within these folders of the stated hive, HKEY_CLASSES_ROOT:
[HKEY_CLASSES_ROOT\jpegfile
or
[HKEY_CLASSES_ROOT\.jpg]
or
[HKEY_CLASSES_ROOT\AppX43hnxtbyyps62jhe9sqpdzxn1790zetc]
Subscribe to:
Posts (Atom)
Script to see network interface connection speed
cat network-speed #!/usr/bin/bash # ethtool enp2s0 | grep Speed ethtool $1 | grep Speed # mii-tool -v enp2s0 mii-tool -v $1 network-speed ...
-
This script with it's two related configuration files worked on Raspberry Pi Raspbian Linux. What was always sketchy was the "dri...
-
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Warn ; Recommended for catching common errors. Send...
-
cat network-speed #!/usr/bin/bash # ethtool enp2s0 | grep Speed ethtool $1 | grep Speed # mii-tool -v enp2s0 mii-tool -v $1 network-speed ...