Skip to content

Instantly share code, notes, and snippets.

@andrewp-as-is
andrewp-as-is / docker-stop-all-containers.sh
Last active Oct 12, 2021
Docker stop all containers #docker
View docker-stop-all-containers.sh
sudo docker ps -q | xargs -r sudo docker stop
@andrewp-as-is
andrewp-as-is / macOS-list-ports.sh
Last active Oct 12, 2021
macOS list ports #macos
View macOS-list-ports.sh
#!/usr/bin/env bash
PORT=8013
lsof -nP -iTCP:$PORT | grep LISTEN;:
View gunicorn-kill-processes.sh
#!/usr/bin/env bash
ps aux | grep gunicorn | awk '{print $2;}' | xargs kill -9 2>/dev/null
ps aux | grep gunicorn | awk '{print $2;}' | xargs kill -9 2>/dev/null
ps aux | grep gunicorn | awk '{print $2;}' | xargs kill -9 2>/dev/null
ps aux | grep python | awk '{print $2;}' | xargs kill -9 2>/dev/null
View certbot.sh
sudo certbot --nginx certonly -d domain.com,www.domain.com --expand
View user.sql
--sudo -u postgres psql -p 5432
CREATE USER username WITH PASSWORD 'secret';
ALTER USER username WITH PASSWORD 'secret';
DROP USER username;
CREATE DATABASE dbname WITH OWNER=username;
GRANT ALL PRIVILEGES ON DATABASE "dbname" to username;
View postgres-status.sh
service postgresql status | tee
sudo pg_lsclusters
ps -ax | grep -v grep | grep postgres
sudo netstat -tulpn | grep :543
@andrewp-as-is
andrewp-as-is / Makefile
Last active Jun 17, 2020
PostgreSQL ssh
View Makefile
SSH_HOSTNAME:=ubuntu@github42
NAME:=github42
VERSION:=12
all:
make sync
make restart
make status
sync:
@andrewp-as-is
andrewp-as-is / postgres-logs.sh
Created Jun 17, 2020
PostgreSQL logs #postgresql
View postgres-logs.sh
sudo find /var/log/postgresql -name '*.log'
sudo find /var/log/postgresql -name '*.log' -exec rm {} \;
@andrewp-as-is
andrewp-as-is / Makefile
Last active Jun 17, 2020
PostgreSQL cluster
View Makefile
SSH_HOSTNAME:=ubuntu@github42
NAME:=github42
VERSION:=12
all:
make sync
make restart
make status
sync:
View docker-exec.sh
sudo docker exec -it "$(sudo docker ps -qf name=NAME)" sh