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

Command line builder to install PyTorch

For Windows:

pip3 install --pre torch torchvision torchaudio --extra-index-url

Removing the existing packages:

pip uninstall charset-normalizer idna mpmath networkx numpy pillow requests sympy torch torchaudio torchvision typing-extensions functorch clean-fid

pip: python -m pip cache purge

anconda/miniconda: conda clean –all


choco install choco-cleaner

nuget: nuget locals all -clear

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

Windows lock screen backgrounds don't support tiling so I use ImageMagick to create a large image made of my tiles:

convert -size 2560x1080 tile:image_to_tile.png tiled_img.jpg

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

Running explorer shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9} will display the old systray config screen so you can turn on the option to always show all icons.

Condensed from this ServerFault post:

# Make group for no-net access, add user to group
groupadd no-net
usermod -a -G no-net USERNAME
# Rules to allow local network access
iptables -A OUTPUT -m owner --gid-owner no-net -d -j ACCEPT
iptables -A OUTPUT -m owner --gid-owner no-net -d -j ACCEPT
# Rule to block other network access
iptables -A OUTPUT -m owner --gid-owner no-net -j DROP
# Rule to block outbound IPv6
ip6tables -A OUTPUT -m owner --gid-owner no-net -j DROP
# Create a script called ''no-net'' containing the following two lines:
sg no-net "$@"

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

# Get rid of cloud init
apt purge -y cloud-init
# Disable IPv6 in the kernel by modifying the CMDLINE options in /etc/default/grub:
# Edit /etc/default/keyboard to include:

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: 2023/01/26 10:33
  • by john