Skip to content

Instantly share code, notes, and snippets.

@dslaw
dslaw / README.md
Last active January 14, 2019 01:08
Setup PIA

After installing PIA provided ovpn files into /etc/openvpn, create a file under /etc/openvpn/pia.txt with your credentials in it. Then install network-manager-openvpn, which provides the update-resolv-conf script. Update the ovpn files to use the script, which resolves DNS issues:

IFS=$(echo -en "\n\b")
for f in $(ls /etc/openvpn/*.ovpn); do
    echo "script-security 2" >> ${f}
    echo "up /etc/openvpn/update-resolv-conf" >> ${f}
 echo "down /etc/openvpn/update-resolv-conf" >> ${f}
@dslaw
dslaw / README.md
Last active August 9, 2019 21:25
Example of CDC using a trigger.

Create a dev database:

docker run \
    -d \
    -p 8011:5432 \
    -e POSTGRES_USER=dev \
    -e POSTGRES_DB=dev \
    -e POSTGRES_PASSWORD=dev \
 --name=pubsub-example \
@dslaw
dslaw / check-pg-activity.sql
Last active September 4, 2020 06:18
Query Postgres activity
select
datname,
state,
usename || ':' || application_name as user_app,
to_char(query_start, 'YYYY-MM-DD HH24:MI') as query_start,
to_char(age(now(), query_start), 'HH24:MI') as "age",
wait_event_type || ':' || wait_event as wait_event,
left(query, 50) as "query",
pid
from pg_stat_activity