Notes about Computers, Computing, Computations, Etc.

Critical Software for Good Computing

  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

Stable Diffusion


Cache Clean-up

Video Stuff

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:

yt-dlp -f 140 -o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" ""

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

yt-dlp -f 22+140

Photo / Image Stuff

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

Tiling a Small Image into a Bigger One

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


Installed Software

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 commands

robocopy /MIR D:\tmbg\Albums I:\TMBG
robocopy /MIR M: T: /XD John-Music /XD "$RECYCLE.BIN" "System Volume Information" "John-Music" /r:0

Fix Windows 11 Systray

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.


Blocking Certain Applications from Network

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 "$@"

Add GUI to Ubuntu 22.04 Server

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

Some Standard Configs for Ubuntu Server 22.04

# 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:

Enable Newer Kernel on Ubuntu Server 22.04

sudo apt install linux-generic-hwe-22.04

Synology ABB on a Linux

Looking Good

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

Setting up Django / PostgreSQL / Nginx on Ubuntu 20.04

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

Setting up Kanboard on Ubuntu 20.04

Writing a Systemd Service file

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

Disable Automounting for Xfce

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 and Restore a Raspberry Pi

# 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}

Postgresql basic commands

Add a user: createuser someusername -P

Create a database: CREATE DATABASE somedb OWNER someusername TEMPLATE template0 ENCODING 'UTF8';

GRANT CREATE ON SCHEMA public TO username;

Postgresql - Upgrade 11 to 13


Text and File Manipulation

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

User Tools