Notes about Computers, Computing, Computations, Etc.

  1. AltDrag lets Windows 10 have Linux-style "hold down a key and click to move a window" support. 1.48Download
  2. Divvy divides up your screen and lets you move windows to different sections with keyboard shortcuts. Download

Change video container from Matroska (mkv) to mp4 (assuming the video codec is supported by mp4):

ffmpeg -i name_of_input_file.mkv -codec copy output_file.mp4
# If there's issues with the audio codec:
ffmpeg -i name_of_input_file.mkv -c:v copy -c:a aac output_file.mp4

Download a Youtube playlist, keeping only the audio in AAC (.m4a) format:

youtube-dl -f 140 -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" ""

Download a Youtube video in a h264 video and AAC audio:

youtube-dl -f 22+140

To fix photo dates when people email you photos and you need to import them into your photo manager and your photo manager shows all the photos as taken today even though you know they were taken weeks ago but people are so bad at sending photos….

# Inspect the original timestamp
exiftool -r -DateTimeOriginal path_to_picture_folder
# Inspect the modification timestamp
exiftool -r -FileModifyDate path_to_picture_folder
# If FileModifyDate doesn't match what you need, you can set it to the original timestamp
# Note: The double quotes are important so that the shell doesn't think you're redirecting I/O from a file.
exiftool -r "-FileModifyDate<DateTimeOriginal" path_to_picture_folder

Gets a list of the software installed on the computer, both 32 and 64 bit. Saves the output to the file C:\Users\Public\Documents\Software.txt

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > C:\users\public\Documents\Software.txt

Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize >> C:\users\public\Documents\Software.txt
robocopy /MIR D:\tmbg\Albums I:\TMBG
robocopy /MIR M: T: /XD John-Music /XD "$RECYCLE.BIN" "System Volume Information" "John-Music" /r:0

There are a couple ways to install Xfce, I prefer the first option:

  1. apt install xubuntu-core - perfect; includes whisker-menu for a good application launcher.
  2. apt install –no-install-recommends xubuntu-core - boots to GUI, very barebones (not even xfce4-terminal).
  3. apt install xfce4 - gives basic installation, still boots to console, so start GUI with startx.

Don't bother with apt install xfce4 –no-install-recommends because apparently installing xorg is just a recommendation, so startx/startxfce will fail :D

Settings for a good-looking Xfce4 installation:

  • Style: Greybird
  • Icons: Elementary Xfce dark
  • Window Theme: Arc-dark

On Debian these are installed with: sudo apt install greybird-gtk-theme elementary-xfce-icon-theme arc-theme

Here are some extensive notes on setting this up. I also have a version for CentOS 8 (RIP) but don't maintain/update it.

Sometimes you have to make a program start automatically at boot. Here's how I do it with systemd.

This came up because I was messing with partition layouts for a project and Xfce kept automatically mounting the drives while I was working on them.

# Don't automount drives
xfconf-query -c thunar-volman -p /automount-drives/enabled -s false
# Don't automount media (CDs?)
xfconf-query -c thunar-volman -p /automount-media/enabled -s false
# backup
dd bs=4M if=/dev/mmcblk0 | gzip > /mnt/recovery-usb/backupbot-20210715.img.gz
# restore
gunzip --stdout backupbot-20210715.img.gz | sudo dd bs=4M of=/dev/{whatever the device is}

Add a newline to the start of a file

# In particular, an LRC lyric file.
sed '1 s/^/\n/' */*.lrc -i

Or realize you made a mistake and don't want newlines at the start of every file.

sed -z -i 's/^\n//' */*.lrc

Find file names with non-ASCII characters

LC_ALL=C find . -name '*[! -~]*'

Find lyric files with a BOM


# Make a list of the files
grep -rl $'\xEF\xBB\xBF' .  | grep .lrc > file_with_boms.txt
# Remove the BOM
while read l; do sed -i '1 s/^\xef\xbb\xbf//'  "$l"; done < file_with_boms.txt
  • notes.txt
  • Last modified: 2022/08/11 12:01
  • by john