Skip to content

Instantly share code, notes, and snippets.

View gigawhitlocks's full-sized avatar
🗽

Ian Whitlock gigawhitlocks

🗽
View GitHub Profile
#!/bin/sh
# Snarf a file or the output of a command into the
# X11 paste buffer using xclip(1).
if [ -z $1 ]; then
name=`basename $0`
echo "Usage: $name [command] <arg1> ... <argN>, or"
echo " $name [file]"
exit 1
fi
@gigawhitlocks
gigawhitlocks / postgres.sh
Created January 23, 2020 00:52 — forked from mrw34/postgres.sh
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) == Linux && echo chown 70 server.key
docker run -d --name postgres -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key