Enabling Quectel EM05-G Modem on Linux
My new Thinkpad has a Quectel EM05-G modem. For some reason it refused to
connect, even though it showed up in Gnome settings on Ubuntu 22.10. I checked
with mmcli -m 0 and it said sim missing as its state.
After some Googling it appeared the modem ships in …
Tunneling SSH over HTTPS with stunnel
I was faced with a firewall denying access to the outside world using ssh. All I had was http/https access via a proxy server which required authentication. I had an Ubuntu jump host outside the network connected to the internet with a free 443 port. I tried accessing that …
Methods for Both Classes and Instances in Python
I came across a situation where it would be nice for a Python class to have a method which works for both the class and its instances, and when called in an instance context, to know on which instance it was invoked. Python does not support this directly, but as …
Traps for the Unwary in Python’s Import System
Enable vi editing mode in IPython 5
Create default profile and set editing mode to 'vi':
ipython profile create echo "c.TerminalInteractiveShell.editing_mode = 'vi'" \ >>~/.ipython/profile_default/ipython_config.py
Keeping SSH Tunnels Up With Autossh
To keep an ssh connection with a tunnel for port forwarding up reliably we can use the autossh command by Carson Harding. If the connection drops, autossh will restart it. Here's a quick recipe to forward local port 33306 to a remote MySQL host listening on port 3306:
# Install autossh …
Flask-SQLAlchemy and PostgreSQL Unit Testing with Transaction Savepoints
PostgreSQL provides us two very powerful features which are helpful with unit testing: transactional DDL and transaction savepoints. In this article I will show you how to use those with Flask-SQLAlchemy unit tests.
Transactional DDL means you can create tables inside a transaction, run tests against them, and roll back …