Skip to content

Instantly share code, notes, and snippets.

@jw3
jw3 / create_triggers
Created February 1, 2025 14:53 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload
CREATE TRIGGER person_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
'email',
'username'
);
CREATE TRIGGER income_notify AFTER INSERT OR UPDATE OR DELETE ON income
FOR EACH ROW EXECUTE PROCEDURE notify_trigger(
'id',
@jw3
jw3 / README.md
Created February 1, 2025 14:50 — forked from goliatone/README.md
Postgres TRIGGER to call NOTIFY with a JSON payload

This TRIGGER function calls PosgreSQL's NOTIFY command with a JSON payload. You can listen for these calls and then send the JSON payload to a message queue (like AMQP/RabbitMQ) or trigger other actions.

Create the trigger with notify_trigger.sql.

When declaring the trigger, supply the column names you want the JSON payload to contain as arguments to the function (see create_triggers.sql)

The payload returns a JSON object:

@jw3
jw3 / config.txt
Last active October 31, 2023 21:34
SunFounder 10.1 Touchscreen boot config /boot/config.txt
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
#hdmi_cvt=1280 800 60 5 0 0 0
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
@jw3
jw3 / GORILLA.BAS
Created June 29, 2022 13:56 — forked from caffo/GORILLA.BAS
QBasic Gorillas
' Q B a s i c G o r i l l a s
'
' Copyright (C) IBM Corporation 1991
'
' Your mission is to hit your opponent with the exploding banana
@jw3
jw3 / __main__.py
Created February 2, 2022 15:21
Gtk Builder and SourceView
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GtkSource
from gi.repository import GObject
def main():
builder = Gtk.Builder()
@jw3
jw3 / cell_rendering.py
Last active September 14, 2021 17:42
Example of a cell renderer that mixes text and an icon
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/cellrenderers.html
# https://python-gtk-3-tutorial.readthedocs.io/en/latest/iconview.html
# https://gist.github.com/geoffyoungs/1231530
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import GObject, Gtk, Gdk, GdkPixbuf
icons = [("Added", "list-add"), ("Delete", "list-remove")]
openssl genrsa -out ca.key 2048
openssl req -new -x509 -days 3650 -key ca.key -out ca.crt
#:: CZ
#:: Prague
#:: Mrackova
#:: Whatever You Need
#::
#:: domain.cz
#:: email@domain.com
@jw3
jw3 / __main__.py
Created February 11, 2021 19:40
example trust gui
import sys
import gi
from fapolicy_analyzer.app import System
# from https://python-gtk-3-tutorial.readthedocs.io/en/latest/builder.html
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
@jw3
jw3 / .geotiff_headers.md
Created June 2, 2020 16:21 — forked from perrygeo/.geotiff_headers.md
Parsing geotiff headers

Optimized determination of Geotiff bounds

This is functional but is merely a workaround until we get vsis3 - you can try out preliminary vsis3 support with GDAL 2.1 and rasterio 0.32a1

Goal: Based on the GeoTiff and TIFF specs, manually parse out tags to allow for the most IO-efficient reading of georeferencing information.

It works almost the same as rio info --bounds but gives a json array, and it's fast

$ time rio info --bounds R4C1.tif

153.984375 24.2578125 154.072265625 24.345703125

# This is the config to install Kubeflow on an existing k8s cluster.
# If the cluster already has istio, comment out the istio install part below.
apiVersion: kfdef.apps.kubeflow.org/v1alpha1
kind: KfDef
metadata:
name: kubeflow_app
namespace: kubeflow
spec:
repos: