Various tricks, snippets, commands for doing things.
Check what package a file belongs to pacman -Qo
Check updateable packages pacman -Qu
:show -A <option name>
More info
Find it's .desktop
file (pacman -Fl caffeine-ng | grep .desktop
) and copy it ~/.config/autostart
.
setup LUKS1-type partition sudo cryptsetup luksFormat --type luks1 /dev/drive
backup LUKS headers sudo cryptsetup luksHeaderBackup --header-backup-file backup-location /dev/nvme0n1p5
closing LVM and LUKS container sudo vgchange -a n vg0 && sudo cryptsetup close cryptdisk
LVM: resize a filesystem
sudo lvm lvscan
to get the volumes, let's say it's /dev/data/root- sudo e2fsck -f /dev/data/root
sudo resize2fs -P /dev/data/root 75G
(last bit is the size)
Shrink LVM container inside a LUKS container https://wiki.archlinux.org/title/Resizing_LVM-on-LUKS#Resize_LVM_physical_Volume
- [find $LV and $VG]
- sudo lvs
- sudo lvresize -L 68G --resizefs $VG/$LV
-
[optionally] defragment the PV: https://unix.stackexchange.com/a/193971
- sudo pvdisplay <opened luks partition, e.g. "/dev/mapper/crypt_pop_os">
- NEW_VOLUME_BYTES = 4* PE_SIZE * TOTAL_PE + UNUSABLE_SIZE
- sudo pvresize --setphysicalvolumesize 69619M
- sudo cryptsetup status crypt_pop_os
- sudo pvdisplay /dev/mapper/crypt_pop_os
- NEW_LUKS_SECTOR_COUNT = TOTAL PE * PE Size [BYTES] / LUKS_SECTOR_SIZE [BYTES]
- sudo vgchange -a n data
- sudo cryptsetup -b $NEW_LUKS_SECTOR_COUNT resize crypt_pop_os
- sudo cryptsetup close crypt_pop_os
- sudo parted /dev/nvme0n1
unit s p[rint]
resizepart 3 NEW_PARTITION_SECTOR_END
Move a partition (100 MiB backwards) echo '+100M,' | sudo sfdisk --move-data /dev/nvme0n1 -N 3
Grow partition to take up the unallocated space after it echo ", +" | ./sfdisk -N 1 /dev/sdc
convert <image paths> output.pdf
or magick convert <image paths> output.pdf
convert
/ magick
is part of imagemagick
ss
nftables
iw
sudo smartctl -a <drive device>
Has to be done for every synced Brave instance, it seems. Toggl extension installed in the browser as an extension. Open extension settings for Toggl, enable Trello, Gitlab, Github.
efibootmgr -v
- show boot options
sudo efibootmgr --delete-bootnum --bootnum 0000
- removing a boot option
sudo efibootmgr --bootorder 0007,0009,0002,0001,0004,0000
- boot order
access port on the remote host from local port
ssh <user>@<address> -N -L <local port>:localhost:<port on remote machine>
allow for remote host to access a local port
ssh -f -N <user>@<address> -R <remote port>:localhost:<local port>
canberra-gtk-play -i bell
nmcli device wifi connect
lspci -vnnn | grep "VGA controller"
Create ~/.config/systemd/user/a-service.service:
[Unit]
Description=Disable Gnome's toolkit-accessibility to prevent QT apps from freezing the desktop
After=graphical.targer
[Service]
Type=oneshot
# the service will be marked as healthy after its process exits
RemainAfterExit=yes
ExecStart=/bin/sh -c "gsettings set org.gnome.desktop.interface toolkit-accessibility false"
[Install]
WantedBy=default.target
Enable it: systemctl --user enable a-service.service
# Create the backup repo from an empty folder:
mkdir ${BACKUP_REPO_DIRECTORY}
borg init ${BACKUP_REPO_DIRECTORY} --encryption repokey
# save the key from here to password manager (e.g. KeePassXC), or to encrypted Git repo (e.g. Keybase Git repo)
borg key export ${BACKUP_REPO_DIRECTORY}
borg create --stats --progress \
"${BACKUP_REPO_DIRECTORY}::$(date --iso-8601=seconds --utc)-${BACKUP_REPO_NAME}" ${DIR_TO_BACKUP}
# first check available batteries
upower -e
# then check, for example
upower -i /org/freedesktop/UPower/devices/battery_BAT0
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa_priv -o IdentitiesOnly=yes' git clone [email protected]:butla/bultrowicz.com
git config --local core.sshCommand "/usr/bin/ssh -o IdentitiesOnly=yes -i /home/butla/.ssh/id_rsa_priv"
git config --local user.email "[email protected]"
from pathlib import Path
import shutil
src = Path('src_dir')
dest = Path('dest_dir')
older = sorted([p for p in src.iterdir() if (p.suffix.lower() in ('.mp4', '.jpg', '.xmp')) and p.name < '20230310'])
for older_media_file in older:
shutil.move(older_media_file, dest)
Change /sys/class/power_supply/BAT0/charge_control_start_threshold
and /sys/class/power_supply/BAT0/charge_control_end_threshold
.
https://linuxconfig.org/how-to-set-battery-charge-thresholds-on-linux
My original values: start - 90, end - 100