Aussie Workbench Miscellaneous

To Do List

  • Create aliases for:
    • append filename
$ for FILE in *; do mv -bv "$FILE" "${FILE%.*}NEW TEXT.${FILE##*.}"; done


* prepend filename

$ for FILE in *; do mv -bv "$FILE" "PREFIX HERE $FILE"; done


* remove from filename
To replace the first occurrence of a pattern with an empty string, use ${parameter/pattern/}:

$ for FILE in *; do mv -nv "$FILE" "${FILE/'TEXT TO REMOVE'/'}"; done


To replace the first occurrence of a pattern with a given string, use ${parameter/pattern/string}:

$ for FILE in *; do mv -nv "$FILE" "${FILE/'REPLACE PATTERN'/'NEW TEXT'}"; done


To replace ALL occurrences, use ${parameter//pattern/string}:

$ for FILE in *; do mv -nv "$FILE" "${FILE//'REPLACE ALL PATTERN'/'NEW TEXT'}"; done


https://stackoverflow.com/questions/13210880/replace-one-substring-for-another-string-in-shell-script
https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion

  • Caution when using rsync –compare-dest

    This will effectively delete all existing files IF the –compare DIR is the same as dest DIR !!! From Man Page: NOTE: beginning with version 3.1.0, rsync will remove a file from a non-empty destination hierarchy if an exact match is found in one of the compare-dest hierarchies (making the end result more closely match a fresh copy).

  • Create new ZFS storage pool and create MySql conatiner
  • Increase size of storage pool and move plex metadata folder into container
  • Create namimg function for TV episodes amd movies
  • Add David Bowie to music files then sync to phone
  • Crypto page: wallets, assets, etc
  • Create a page for squid proxy config file, etc
  • Instructions on how to set up rtorrent config file
  • working with magnet links to auto start in :rtorrent magnet_to_rtorrent.sh
#!/bin/bash
# watch_folder=/net/pluto/media/data/casper/rtorrent/watch/start
 watch_folder=/home/wayne/to_casper_watch/
 cd $watch_folder
 [[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit;
 echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"


  • Map of how auto torrent downloads are between PCs

Markdown

Markdown Guide

Bash

Bash: String Manipulations
Bash: looping through files

$ for FILE in *; do mediainfo --Inform="Video;%Format%" "$FILE" | grep -i HEVC; done

Notepad++

Recovering from Notepad++ crash

$ cat ~/snap/notepad-plus-plus/common/.wine/drive_c/users/wayne/Temp/N++RECOV/File* >> destination_file.txt

System Admin / Ubuntu Issues

Ubuntu Pro
excluding directories in find
apt-key depecated issue
ttys and switching between them
https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1604
list config files ignoring remarks “#”

$ grep "^[^#]" /etc/apt/sources.list

Where cameras ae mounted
I have to open the camera from nautilus (Ubuntu’s file manager) before I see it

$ cd /run/user/1000/gvfs/

Literary and Language

Metaphor, Simile, and Analogy: What’s the Difference?
Persuasive analogies

Resilio

resilio over LAN only
autostart resilio USER

Incremental backups using RSYNC

https://linuxconfig.org/how-to-create-incremental-backups-using-rsync-on-linux
https://unix.stackexchange.com/questions/345036/alternative-of-rsync-delete-to-move-files-to-another-directory-instead-of-dele
Ask Ubuntu: Simple rsync incremental backup that timestamps deleted files

mediainfo (HEVC)

find /videos/ -type f \
-exec bash -c 'mediainfo --Inform="Video;%Format%" "{}" | grep -i HEVC' \; \
-exec ls -h {} \;

https://unix.stackexchange.com/questions/21033/how-can-i-grep-the-results-of-find-using-exec-and-still-output-to-a-file

Working with Drives

Label USb / SSD / FLASH drives

$ sudo e2label /dev/sdb1 BLACK512

fstab
removable hdd defined in fstab causing problems at startup when not present
mount
nobootwait vs nofail
list all partitions
Mount USB drive from command line

$ udiskctl status
$ udisksctl mount -b /dev/sdb

plex

adding local subtitles

Quickbooks Maintenance

Recommended Monthly Maintenance for QBW Files

Windows 7 to SAMBA server issue

Enter network password pop up
SuperUser: Not able to cnnect to a SAMBA server from Windows 7