Skip to content

Instantly share code, notes, and snippets.

View andrewp-as-is's full-sized avatar
🔍

Andrew P andrewp-as-is

🔍
View GitHub Profile
@andrewp-as-is
andrewp-as-is / postgres-logs.sh
Created June 17, 2020 13:16
PostgreSQL logs #postgresql
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
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
sudo docker exec -it "$(sudo docker ps -qf name=NAME)" sh
@andrewp-as-is
andrewp-as-is / Docker base image.sh
Last active October 11, 2021 08:45
Docker base image
sudo docker login --username username
# Dockerfile required
sudo docker build -t username/python:3.8-alpine-psycopg2 .
sudo docker push username/python:3.8-alpine-psycopg2
@andrewp-as-is
andrewp-as-is / middleware.txt
Created June 17, 2020 13:16
Django middleware list
django.middleware.security.SecurityMiddleware
django.contrib.sessions.middleware.SessionMiddleware
django.middleware.common.CommonMiddleware
django.middleware.csrf.CsrfViewMiddleware
django.contrib.auth.middleware.AuthenticationMiddleware
django.contrib.messages.middleware.MessageMiddleware
django.middleware.clickjacking.XFrameOptionsMiddleware
@andrewp-as-is
andrewp-as-is / Makefile
Last active June 19, 2020 19:11
AWS EC2 mount volume
SSH_HOSTNAME:=aws
all:
ssh $(SSH_HOSTNAME) < ./e2-mount-volume.sh
@andrewp-as-is
andrewp-as-is / github-repos-homepage-update.sh
Last active July 18, 2021 21:46
github repos homepage update
#!/usr/bin/env bash
# pip install github-homepage github-repos
# export GITHUB_TOKEN=<GITHUB_TOKEN>
login="$(git config user.name)" || exit
# url="https://github42.com/$login/"
url=''
repos="$(python -m github_repos)" || exit
@andrewp-as-is
andrewp-as-is / description.sh
Last active July 18, 2021 22:49
github repos homepage update
#!/usr/bin/env bash
# pip install github-description github-repos
# export GITHUB_TOKEN=<GITHUB_TOKEN>
repos="$(python -m github_repos)" || exit
[[ -n "$repos" ]] && while IFS= read full_name; do
path=~/git/"$full_name"/.config/description.txt
[ -e "$path" ] && {
@andrewp-as-is
andrewp-as-is / github-list-orphaned-repos.sh
Last active May 25, 2020 06:15
github list orphaned repos
#!/usr/bin/env bash
# pip install github-repos
# export GITHUB_TOKEN=<GITHUB_TOKEN>
repos="$(python -m github_repos)" || exit
[[ -n "$repos" ]] && while IFS= read full_name; do
path=~/git/"$full_name"
! [ -e "$path" ] && echo "$path"
@andrewp-as-is
andrewp-as-is / github-delete-orphaned-repos.sh
Last active May 25, 2020 06:15
github delete orphaned repos
#!/usr/bin/env bash
# pip install github-delete github-repos
# export GITHUB_TOKEN=<GITHUB_TOKEN>
repos="$(python -m github_repos)" || exit
[[ -n "$repos" ]] && while IFS= read full_name; do
path=~/git/"$full_name"
! [ -e "$path" ] && { ( set -x; github-delete "$full_name" ) || exit; }