Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
kissgyorgy / listen.py
Created September 4, 2020 16:37
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")
@marcorichetta
marcorichetta / postgresql-manjaro.md
Last active June 2, 2024 19:31
Install PostgreSQL on Manjaro and set it up for Django
@Bluexin
Bluexin / msys2.md
Last active February 22, 2024 13:24
Setting up qtcreator with msys2 on windub
@TheKewlStore
TheKewlStore / item_data.py
Last active August 3, 2022 14:06
PyQt4 QAbstractItemModel subclasses
""" Define a data container to be used with model subclasses that emits a generic signal whenever data in the internal dictionary
is changed. This creates a consistent API layer with model items that can be edited programatically as dictionaries, and
automatically kept synchronized in the model and the view.
"""
__author__ = 'Ian Davis'
__all__ = ['ItemData', ]
from api.util.event_util import Signal