An example python script to crop an image using the Pillow library and run using the uv package manager. To install uv see: https://docs.astral.sh/uv/getting-started/installation #!/usr/bin/env -S uv run --script # /// script # reqires-python = ">=3.13" # dependencies = ["pillow>=11.2.1"] # /// import os, sys from PIL import Image def main(): for infile in sys.argv[1:]: f, e = os.path.splitext(infile) outfile = f + ".jpg" if infile != outfile: try: with Image.open(infile) as im: (left, upper, right, lower) = (280, 180, 1625, 940) im_crop = im.crop((left, upper, right, lower)).convert("RGB") im_crop.save(outfile) except OSError as e: print(e) if __name__ == "__main__": main() Be sure to make the scrip executable: chmod +x crop-screenshot.py ...
Install Guest Tools on Arch VMs
On Proxmox: sudo pacman -S qemu-guest-agent sudo systemctl status qemu-guest-agent On xcp-ng: mkdir -p github/aur cd github/aur git clone https://aur.archlinux.org/xe-guest-utilities-xcp-ng.git cd xe-guest-utilities-xcp-ng less PKGBUILD makepkg -sic sudo systemctl enable xe-linux-distribution.service sudo systemctl start xe-linux-distribution.service sudo systemctl status xe-linux-distribution.service
Initial settings for ksh history, prompt and aliases
Out of the box, OpenBSD doesn’t come with a history file set, so when you logoff your history for that session is lost. Here’s how I set the history file and a few favourite aliases. While we’re at it we might as well set the prompt at the same time. echo "export ENV='$HOME/.kshrc'" >> .profile # for user: echo "export PS1='\u@\h:\w$ '" >> .profile # for root: echo "export PS1='\u@\h:\w# '" >> .profile Put the following in .kshrc ...
Change to single partition AFTER installation
You can change OpenBSD to run using a single partition after doing a default installation. You might rightly ask why on earth you would want to do this, after all the FAQ “encourages users to split their disk into a number of partitions”. Well it’s great if you have a large disk and in a secure implementation but what if you just want to run on a single partition to make better use of the disk or virtual disk space. ...
Web log analysis on OpenBSD using GoAccess
GoAccess is an open source real-time web log analyzer and interactive viewer that runs in a terminal in *nix systems or through your browser. Requirements This only works with httpd, tested on OpenBSD 6.4 Assumes your log style is set to common (default) Install the GoAccess package $ doas pkg_add goaccess Run from the command line Read access.log, remove the domain from beginning of each line and save as stats.log ...