Skip to content

Instantly share code, notes, and snippets.

View lucaswiman's full-sized avatar

[object Object] lucaswiman

View GitHub Profile
@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;")
@InfoSec812
InfoSec812 / jsonb_patch.sql
Last active April 17, 2024 21:08
Pure PostgreSQL implementation of JSONPatch
!!
!! Implementation of JSONPatch (http://jsonpatch.com/) using PostgreSQL >= 9.5
!!
CREATE OR REPLACE FUNCTION jsonb_copy(JSONB, TEXT[], TEXT[]) RETURNS JSONB AS $$
DECLARE
retval ALIAS FOR $1;
src_path ALIAS FOR $2;
dst_path ALIAS FOR $3;
tmp_value JSONB;
@heri16
heri16 / ProcessExtensions.cs
Created July 13, 2016 16:17
Powershell / C# class to start a GUI Windows Process on the desktop/session of any logged-in RDP/TS user.
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
using System.IO;
namespace heri16
{
/// <summary>
/// Static class to help Start a GUI/Console Windows Process as any user that is logged-in to an Interactive Terminal-Session (e.g. RDP).
@monstermunchkin
monstermunchkin / SecureXMLRPCServer.py
Created July 22, 2011 19:29
SSL / TLS XML-RPC Server in Python
import socketserver
import ssl
import xmlrpc.server
try:
import fcntl
except ImportError:
fcntl = None
class SecureXMLRPCServer(socketserver.TCPServer,
xmlrpc.server.SimpleXMLRPCDispatcher):