geek

GPG Key Transition 2022

Doing end-of-the-year security housekeeping and figured it was time to generate a new GPG key with modern defaults. After looking into the model of a main key stored offline (like in a firesafe) and only using subkeys locally, I decided it wasn’t worth the effort. The reality is I almost only use these for signing GitHub commits. 🤷

The cypherpunk fever dreams of key signing parties and a robust web of trust feel pretty far away. Even Keybase is no longer mentioned. We’ll continue to solve this in different ways.

At any rate, my transition statement is linked here and included below.

virtualenv-burrito 2.7

Yesterday, virtualenv-burrito 2.7 was released. There are two significant changes:

  1. All Python packages in the .venvburrito directory are now inside a versioned site-packages directory. For example, if you are running Python 2.7 during the install or upgrade, all packages will now live in lib/python2.7/site-packages.
  2. The pip program is no longer user accessible (i.e., in the PATH). You could easily figure out where it’s been moved, but that’s discouraged (and unsupported).

Python cron task – exit if already running

A simple way for Python cron tasks to exit if another process is currently running. Does not use a pidfile.

import os
import subprocess
import shlex


def bail_if_another_is_running():
    cmd = shlex.split("pgrep -u {} -f {}".format(os.getuid(), __file__))
    pids = subprocess.check_output(cmd).strip().split('\n')
    if len(pids) > 1:
        pids.remove("{}".format(os.getpid()))
        print "Exiting! Found {} is already running (pids): {}".format(
            __file__, " ".join(pids))
        raise SystemExit(1)

Virtualenvs with different interpreters

Update 2011-09-27: Turns out virtualenv and virtualenvwrapper support this out of the box. Most of what’s written below is horrifically complex compared to just using the -p switch when you make your virtualenv. You simply need to do this:

mkvirtualenv -p /path/to/some/python coolname

That’ll create a new virtualenv called “coolname” that uses /path/to/some/python for it’s Python interpreter. I’ve tested this with PyPy and it worked great.