This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.
publish message to foo
channel from user nickname
.
$ python pub.py foo nickname
PUBLISH to channel #foo
WITH tab AS ( | |
SELECT | |
a.attrelid::regclass::text AS t, | |
a.attname AS c, | |
pg_get_serial_sequence(a.attrelid::regclass::text, a.attname) AS s, | |
nextval(pg_get_serial_sequence(a.attrelid::regclass::text, a.attname)) AS v | |
FROM pg_attribute a | |
JOIN pg_class c ON c.oid = a.attrelid | |
WHERE | |
a.attrelid::regclass::text LIKE '%' |
from django.apps import apps | |
HEADER = """@startuml | |
skinparam linetype ortho | |
""" | |
FOOTER = """@enduml""" | |
Models = apps.get_models() |
use std::fs::File; | |
use std::io::prelude::*; | |
const BYTES_PER_LINE: usize = 16; | |
fn main() { | |
let mut f= File::open("/tmp/file.txt").unwrap(); | |
let mut pos = 0; | |
let mut buffer = [0; BYTES_PER_LINE]; |
#!/bin/sh | |
MAC=XX_XX_XX_XX_XX_XX | |
NEW_SINK=bluez_sink.$MAC.a2dp_sink | |
pactl set-card-profile bluez_card.$MAC a2dp_sink | |
pactl set-default-sink $NEW_SINK | |
sink_inputs=$(pactl list | grep -P "Sink Input #\d+" | grep -Po "\d+") | |
for sink_input in $sink_inputs ; do |
#!/usr/bin/bash | |
ffmpeg \ | |
-f alsa -sample_rate 44100 -thread_queue_size 1024 -itsoffset -0.5 -i hw:0 \ | |
-f x11grab -r 30 -thread_queue_size 1024 -i :0.0 \ | |
-f v4l2 -r 30 -video_size 320x180 -thread_queue_size 1024 -i /dev/video0 \ | |
-filter_complex " | |
[1:v]scale=1920x1080[slides]; | |
[slides][2:v]overlay=x=1580:y=20 | |
" \ |
# Install ARCH Linux with encrypted file-system and UEFI | |
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
# Download the archiso image from https://www.archlinux.org/ | |
# Copy to a usb-drive | |
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
# Optionally set another keyboard layout. E.g. German |
data_dir = "/var/lib/vector" | |
# Sources | |
[sources.nginx_access_logs] | |
type = "file" | |
exclude = ["/var/log/nginx/error.log"] | |
include = ["/var/log/nginx/*.log"] | |
file_key = "log" | |
host_key = "server" |
import base64 | |
import hmac | |
import json | |
import secrets | |
def gen_token(key: bytes, data) -> str: | |
payload = json.dumps(data).encode() | |
mac = base64.urlsafe_b64encode(hmac.new(key, payload, "sha256").digest()) | |
return base64.urlsafe_b64encode(payload).decode() + "." + mac.decode() |
diff --git a/django/db/backends/postgresql_psycopg2/schema.py b/django/db/backends/postgresql_psycopg2/schema.py | |
index 8340059..692866e 100644 | |
--- a/django/db/backends/postgresql_psycopg2/schema.py | |
+++ b/django/db/backends/postgresql_psycopg2/schema.py | |
@@ -1,6 +1,21 @@ | |
import psycopg2 | |
from django.db.backends.base.schema import BaseDatabaseSchemaEditor | |
+from django.db.models.expressions import Func | |
+from django.db.models.sql.compiler import SQLCompiler |