Skip to content

Instantly share code, notes, and snippets.

View sopanatx's full-sized avatar
🎯
Focusing

Sopanat Suradach sopanatx

🎯
Focusing
View GitHub Profile
@mrw34
mrw34 / postgres.sh
Last active June 9, 2025 05:14
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 && chown 70 server.key
docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -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
@nandotorres
nandotorres / packer_build.sh
Created December 12, 2016 17:54
Shell script to run packer command line tool and build an AMI with Chef cookbook
#!/bin/bash
rm -rf vendor/*
# Group all recipes and cookbooks for provisioning
chef exec berks vendor vendor/cookbooks
chef exec berks install
##########################################################
# Deregister any existing image for this commit revision
# Note: $CI_BUILD_REF is authomatically exported by GitLab
@idleberg
idleberg / DropboxIgnore.md
Last active June 4, 2023 12:02
Ignore node_modules/bower_components folders in your Dropbox

This script scans your Dropbox (or any given folder) for folders stored in the ignore array and excludes them from syncing. Makes use of the official Dropbox CLI

I'm a beginner at bash, so all improvements are welcome!

#!/bin/bash

set -e

# SETTINGS
@quiver
quiver / README.md
Last active September 19, 2024 12:21
Who says PostgreSQL can't Pub/Sub like Redis?

Pub/Sub pattern with PostgreSQL's LISTEN/NOTIFY command

This is a simple chat-like program using pub-sub pattern, backed by PostgreSQL's LISTEN/NOTIFY command.

Publish

publish message to foo channel from user nickname.

$ python pub.py foo nickname
PUBLISH to channel #foo