Mikko Kortelainen

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 …

read more

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 …

read more

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 …

read more

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 …
read more

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 …

read more

OpenStreetMap Nominatim Server for Geocoding

Here's how to install the OpenStreetMap Nominatim service on your own server. It can be used to geocode and reverse geocode addresses and map coordinates. You will also get a web interface which loads map tiles from openstreetmap.org while doing geocoding requests using your own server.

I was faced …

read more

Remove Unwanted Files From Git History

Here's an example of how to remove every *.pyc file from every commit in Git history. It is adapted from this Git help page.

Rewrite history

Run git filter-branch, forcing (--force) Git to process—but not check out (--index-filter)—the entire history of every branch and tag (--tag-name-filter cat -- --all …

read more
Page 1 of 9 >>