Skip to content

Instantly share code, notes, and snippets.

View tmountain's full-sized avatar

Travis Whitton tmountain

View GitHub Profile
-- call auth.login_as_user('[email protected]');
create or replace procedure auth.login_as_user(user_email text)
language plpgsql
as $$
declare
auth_user auth.users;
event_jsonb jsonb;
result_event jsonb;
begin
@tmountain
tmountain / read.sql
Created September 20, 2024 10:47
PGMQ read benchmark
DO $$
DECLARE
batch_size INT := 100000; -- Number of messages to pop per batch
total_messages INT := 0; -- Count of total messages popped
batch_count INT := 0; -- Count messages in the current batch
start_time TIMESTAMP;
end_time TIMESTAMP;
result RECORD;
queue_name TEXT := 'my_queue';
message_ids BIGINT[] := '{}'; -- Array to hold message IDs for bulk delete
@tmountain
tmountain / insert.sql
Created September 20, 2024 10:45
PGMQ insert benchmark
-- SELECT pgmq.create('my_queue');
DO $$
DECLARE
i INT;
batch_size INT := 1000; -- Change this to experiment with different batch sizes
total_messages INT := 1000000; -- Total number of messages to send
msgs JSONB[];
start_time TIMESTAMP;
end_time TIMESTAMP;
queue_name TEXT := 'my_queue';
# cat extlinux.conf
# Generated file, all changes will be lost on nixos-rebuild!
# Change this to e.g. nixos-42 to temporarily boot to an older configuration.
DEFAULT nixos-default
MENU TITLE ------------------------------------------------------------
TIMEOUT 50
LABEL nixos-default
@tmountain
tmountain / brcmfmac4356-sdio.txt
Created January 29, 2021 22:05
firmware for brcmfmac4356
# Sample variables file for BCM94356Z NGFF 22x30mm iPA, iLNA board with PCIe for production package
NVRAMRev=$Rev: 492104 $
#4356 chip = 4354 A2 chip
sromrev=11
boardrev=0x1102
boardtype=0x073e
boardflags=0x02400201
#0x2000 enable 2G spur WAR
boardflags2=0x00802000
boardflags3=0x0000000a
[ 0.000000] Booting Linux on
physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.4.89 (nixbld@localhost) (gcc version 9.3.0 (GCC)) #1-NixOS SMP Tue Jan 12 19:16:25 UTC 2021
[ 0.000000] Machine model: FriendlyElec NanoPC-T4
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 32 MiB at 0x00000000f6000000
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000000200000-0x00000000f7ffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0xf57ef800-0xf57f0fff]
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.4.89 (nixbld@localhost) (gcc version 9.3.0 (GCC)) #1-NixOS SMP Tue Jan 12 19:16:25 UTC 2021
[ 0.000000] Machine model: FriendlyElec NanoPC-T4
[ 0.000000] efi: Getting EFI parameters from FDT:
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 32 MiB at 0x00000000f6000000
[ 0.000000] NUMA: No NUMA configuration found
[ 0.000000] NUMA: Faking a node at [mem 0x0000000000200000-0x00000000f7ffffff]
[ 0.000000] NUMA: NODE_DATA [mem 0xf57ef800-0xf57f0fff]
[ 0.000000] Zone ranges:
@tmountain
tmountain / gofib.go
Created February 27, 2020 19:04
Testing Golang's ability to saturate cores
package main
import (
"fmt"
)
func fibonacci(n uint) uint64 {
if n <= 1 {
return uint64(n)
}
@tmountain
tmountain / tmux-cheat-sheet.md
Created October 16, 2019 19:41 — forked from michaellihs/tmux-cheat-sheet.md
tmux Cheat Sheet
@tmountain
tmountain / gist:9efe97933a8326c508322c71547170c0
Created June 14, 2019 14:56
transaction isolation levels
mysql> describe account;
+----------+------------------+------+-----+-------------------+-------------------+
| Field | Type | Null | Key | Default | Extra |
+----------+------------------+------+-----+-------------------+-------------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| username | varchar(255) | NO | | NULL | |
| ts | timestamp | YES | | CURRENT_TIMESTAMP | DEFAULT_GENERATED |
+----------+------------------+------+-----+-------------------+-------------------+
3 rows in set (0.01 sec)