Skip to content

Instantly share code, notes, and snippets.

@edib
edib / rsyncwal.sh
Last active November 5, 2018 09:45
postgresql multiple host and pgbacrest wall archive script
#!/bin/bash
rsync -q -ae ssh $1 \ postgres@<replica1>:<xlog_archive_path>/$2
rsync -q -ae ssh $1 \ postgres@<replica2>:<xlog_archive_path>/$2
if [ $? != 0 ]
then
echo "Archiver error:"
exit 1
fi
@cmer
cmer / haproxy.cfg
Last active October 8, 2025 18:11
Simple, no bullshit TCP port forwarding using HAProxy
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443
@vasanthk
vasanthk / System Design.md
Last active December 11, 2025 11:16
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active December 5, 2025 09:56
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'