Skip to content

Instantly share code, notes, and snippets.

@pveierland
pveierland / celery_test_util.py
Created September 30, 2022 09:28 — forked from alexgarel/celery_test_util.py
Helper for tests with celery, running tasks in main thread but keeping control on when (alternative to eager)
from functools import partial
from celery.app.task import Task
from celery.app.utils import find_app
class CeleryTestTask(object):
"""A context manager to patch task in order to queue delayed tasks
and eventually run them. This is for tests.
@pveierland
pveierland / encrypt_password.py
Created April 30, 2022 09:48 — forked from jkatz/encrypt_password.py
Methods to create password verifiers for PostgreSQL
# Copyright 2019-2022 Jonathan S. Katz
#
# MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#!/bin/bash
# SET THIS TO BE YOUR DESIRED USERNAME
export MY_USER_NAME_FOR_CERT=`whoami`
# This directory is optional, but will use it to keep the CA root key safe
mkdir keys certs
chmod og-rwx keys certs
# Set up a directory that will serve as the pgconf mount