Skip to content

Instantly share code, notes, and snippets.

To create an asynchronous Python context manager, including MyPy type hints, in Python 3.10, add these imports:

from __future__ import annotations

from types import TracebackType
from typing import Type

Then add these functions:

@wvreeven
wvreeven / Create a self-signed certificate for a printer.md
Last active August 20, 2022 09:53
Create a self-signed certificate for a printer

Login to the printer EWS (Embedded Web Server). Go to Network -> Security -> Certificates. Click Configure and select Create a Certificate Request. Fill out the details and create the CSR (Certificate Signing Request). Save the CSR. It will be called CertRequest.pem.

Using OpenSSL create a private key with no password:

openssl genrsa -out printer_private_key.pem 2048
@wvreeven
wvreeven / Set up VPN on ASIAir
Last active November 15, 2021 10:30
Set up VPN on ASIAir
If you are lucky enough to have a permanent set up with a mount, a telescope, a camera and an ASIAir then you
may wonder how to make sure that you can connect to the ASIAir remotely. With remotely I mean: while not being
connected to the same network as the ASIAir. For instance, you have your fixed setup in the backyard and you are
out having dinner at a friend's place and you notice that the sky is clear.
Arguably the most secure way to enable this is to use a VPN. Beware, however, that even a VPN connection may not
be safe depending on what VPN provider you use and what traffic is allowed over the connection. Therefore this
disclaimer:
I CANNOT BE HELD RESPONSIBLE FOR ANY SECURITY BREACH OR OTHER DAMAGE RESULTING FROM FOLLOWING THIS GUIDELINE!!!!
@wvreeven
wvreeven / Set up a fixed ethernet IP address on ASIAir
Last active September 10, 2021 09:31
Set up a fixed ethernet IP address on ASIAir
Many ASIAir users complain about the poor WIFI signal. In order to fix that, ZWO announced in September 2021 that they
were going to release a new product: the ASIAir Plus. However, that doesn't solve the WIFI issue on existing ASIAir and
ASIAir Pro. It is possible to use a portable WIFI router to ASIAir however that introduces a few challenges. First of
all, there is yet another device that needs power. If you have an ASIAir Pro then of course can power the router from
one of the power ports but still more power is consumed which requires bigger batteries. Secondly, the WIFI router needs
to be connected to the ASIAir somehow which either requires an additional cable or introduces more weight for the mount
to carry.
I am not a big fan of WIFI myself and I prefer an ethernet connection. Especially with my ASI6200MM full frame camera,
downloading the images is MUCH faster via a cable than via WIFI. Connecting to the ASIAir will introduce another cable
@wvreeven
wvreeven / Add your public openssh key to ASIAIR
Last active September 10, 2021 10:15
Add your public openssh key to ASIAIR
Unlike other instructions found on the internet, these ones do not use the root user. In general you should NOT use the
root user on Linux. Use the pi user on ASIAir instead. If root access is needed then use the sudo command.
You will need to mount the partitions onn the SD card with write access. This is easy under Linux but not everyone uses
that. Unfortunately both Windows and Mac do not natively support writing to the Linux ext4 file system. There are paid
solutions for Windows but since I am not a Windows user, I didn't try those. I am on a MacBook myself so I have set up a
Linux VM in VirtualBox and gave that permissions to access the USB card reader containing the SD card. I chose Ubuntu
20.04 but of course you're free to choose whatever distro you prefer.
There are four partitions on the SD card: