Skip to content

Instantly share code, notes, and snippets.

Avatar
🔍

Andrew P andrewp-as-is

🔍
View GitHub Profile
@andrewp-as-is
andrewp-as-is / docker-stop-all-containers.sh
Last active October 12, 2021 19:45
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 October 12, 2021 19:45
macOS list ports #macos
View macOS-list-ports.sh
#!/usr/bin/env bash
PORT=8013
lsof -nP -iTCP:$PORT | grep LISTEN;:
@andrewp-as-is
andrewp-as-is / gunicorn-kill-processes.sh
Created June 17, 2020 13:16
gunicorn kill processes
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
@andrewp-as-is
andrewp-as-is / certbot.sh
Last active June 17, 2020 13:19
certbot
View certbot.sh
sudo certbot --nginx certonly -d domain.com,www.domain.com --expand
@andrewp-as-is
andrewp-as-is / user.sql
Created June 17, 2020 13:16
PostgreSQL user
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;
@andrewp-as-is
andrewp-as-is / postgres-status.sh
Created June 17, 2020 13:16
PostgreSQL status
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 June 17, 2020 13:19
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 June 17, 2020 13:16
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 June 17, 2020 13:19
PostgreSQL cluster
View Makefile
SSH_HOSTNAME:=ubuntu@github42
NAME:=github42
VERSION:=12
all:
make sync
make restart
make status
sync:
@andrewp-as-is
andrewp-as-is / docker-exec.sh
Last active June 17, 2020 13:19
Docker exec
View docker-exec.sh
sudo docker exec -it "$(sudo docker ps -qf name=NAME)" sh