Arguably, if you're OK with modifying the image to auto-run a script at the first boot, you could simply modify the image in the way your script would, and then save that SD card to an image file and use it to flash SD cards you're going to use with new RPis. For instance, if you want all your RPis to have a certain entry in /etc/fstab, you could simply ...
For a headless server with virtual desktop, try using vncserver-virtuald.service instead:
sudo systemctl enable vncserver-virtuald.service
sudo systemctl start vncserver-virtuald.service
Or use vncserver-x11-serviced.service and add hdmi_force_hotplug=1 to /boot/config.txt as @bigmac described to view the same desktop as presented over the HDMI output.
You don't really need to generate a key to connect to your rpi.
Just connect (via ssh) to your pi with ssh pi@<hostname or IP>
I don't think it will resolve as raspberrypi.local, I have mine resolving as raspberrypi - but I'd first make sure it gets onto your network (via your router/whatever you use for your wifi or arp -a on mac) and use its IP ...
Scanning for devices is a core feature of Bluetooth Low-Energy.
For Linux, the official protocol stack for Bluetooth is BlueZ, and many tools and services will derive their functionality from it. I mention this because, while there are plenty of software-specific tools available (like noble for Node.js, or bluepy for Python), they are essentially adapters ...
I had the same problem with my Pi Zero W V1.1. What I did:
used balenaEtcher on my Mac to install Raspbian Buster
reinserted the sd card into my Mac created empty file named ssh on
first partition boot (not the folder on the second partition rootfs
which does not get mounted on my Mac anyway)
created the wpa_supplicant.conf:
Most current OS like, for example, Raspbian use the systemd init system by default. Assuming you have an OS with systemd (check you have it installed with command systemd --version) you can easily create a service that runs your python script at startup.
Change your settings to have the RPi boot into text console mode instead of GUI
sudo systemctl set-...