View schema-origin-none-long-db1.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is based on the code from | |
-- https://raw.githubusercontent.com/CrunchyData/postgres-realtime-demo/main/examples/demo/demo1.sql | |
-- which was originally released under the Apache 2.0 License | |
-- https://github.com/CrunchyData/postgres-realtime-demo/blob/main/LICENSE | |
CREATE SEQUENCE public.room_id_1_seq AS int INCREMENT BY 2 START WITH 1; | |
CREATE SEQUENCE public.room_id_2_seq AS int INCREMENT BY 2 START WITH 2; | |
CREATE TABLE public.room ( | |
id int DEFAULT nextval('room_id_1_seq') PRIMARY KEY, | |
name text NOT NULL |
View schema-origin-none-db1.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is based on the code from | |
-- https://raw.githubusercontent.com/CrunchyData/postgres-realtime-demo/main/examples/demo/demo1.sql | |
-- which was originally released under the Apache 2.0 License | |
-- https://github.com/CrunchyData/postgres-realtime-demo/blob/main/LICENSE | |
CREATE TABLE public.room ( | |
id int GENERATED BY DEFAULT AS IDENTITY (INCREMENT 2 START WITH 1) PRIMARY KEY, | |
name text NOT NULL | |
); |
View schema-with-atomic.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is based on the code from | |
-- https://raw.githubusercontent.com/CrunchyData/postgres-realtime-demo/main/examples/demo/demo1.sql | |
-- which was originally released under the Apache 2.0 License | |
-- https://github.com/CrunchyData/postgres-realtime-demo/blob/main/LICENSE | |
/** | |
* Schema | |
*/ | |
CREATE TABLE public.room ( | |
id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, |
View schema-qual.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is based on the code from | |
-- https://raw.githubusercontent.com/CrunchyData/postgres-realtime-demo/main/examples/demo/demo1.sql | |
-- which was originally released under the Apache 2.0 License | |
-- https://github.com/CrunchyData/postgres-realtime-demo/blob/main/LICENSE | |
/** | |
* Schema | |
*/ | |
CREATE TABLE public.room ( | |
id int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, |
View gist:de1b3c9c332a20d5c9ec3d1715c13e37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE data (id int PRIMARY KEY); | |
INSERT INTO data SELECT * FROM generate_series(1,5000000); | |
---- | |
EXPLAIN ANALYZE | |
WITH r AS ( | |
SELECT (random() * (SELECT count(*) FROM data))::int x | |
) | |
SELECT data.* | |
FROM r |
View gist:5a36cfce7219384bd16a79aee7cec6bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pgo create cluster postgres -n pgo --database=keycloak --username=admin --password=admin | |
# wait for startup | |
cat <<-EOF > kc-deploy.yaml | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: keycloak | |
labels: |
View password.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PASSWORD_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
+ 'abcdefghijklmnopqrstuvwxyz' | |
+ '01234567890' | |
+ '!#$%&()*+,-./:;<=>?@[]^_`{|}~\/"\' '; | |
function generateRandomPassword(passwordLength=16) { | |
// if crypto not defined, bail | |
if (!window.crypto) { | |
throw new Error('The "crypto" library is not available'); | |
} |
View quickstart-postgresql-cert.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View encrypt_password.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |
View scram_poc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import hashlib | |
import hmac | |
import re | |
import secrets | |
import socket | |
class SCRAMAuthentication(object): | |
AUTHENTICATION_METHOD = b"SCRAM-SHA-256" | |
DIGEST = hashlib.sha256 |
NewerOlder