For some reason my computer locks up if it goes idle. This script will install a systemd timer to keep it alive, by performing a small calculation every minute.
Copy and paste this entire script into your BASH shell, including the starting and ending parentheses:
( set -e
# Install systemd unit in regular user account:
mkdir -p ~/.config/systemd/user
cat <<EOF > ~/.config/systemd/user/cpu_keepalive.timer
[Unit]
Description=cpu_keepalive.timer
[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true
[Install]
WantedBy=timers.target
EOF
cat <<EOF > ~/.config/systemd/user/cpu_keepalive.service
[Unit]
Description=cpu_keepalive.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "dd if=/dev/urandom bs=5M count=1 2>&1 | bzip2 | base64 > /dev/null"
KillSignal=SIGKILL
EOF
systemctl --user daemon-reload
systemctl --user enable --now cpu_keepalive.timer
systemctl --user --no-pager status cpu_keepalive
)