This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import django | |
from django.contrib.auth.management.commands import createsuperuser | |
from django.core.management import CommandError | |
from django.db import DEFAULT_DB_ALIAS | |
""" | |
python manage.py createsuperuser --username admin --password admin | |
python manage.py createsuperuser --username admin --password admin --email foo@foo.foo | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://certbot.eff.org/lets-encrypt/ubuntubionic-nginx | |
sudo apt-get update | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository universe | |
sudo add-apt-repository ppa:certbot/certbot | |
sudo apt-get update | |
sudo apt-get --assume-yes install certbot python-certbot-nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sysctl -n kern.boottime | |
sysctl -n kern.boottime | awk '{split($0,a,",");print a[1]}' | grep -oE "[[:digit:]]{1,}" | |
uptime=$(sysctl -n kern.boottime | awk '{split($0,a,",");print a[1]}' | grep -oE "[[:digit:]]{1,}") | |
now=$(date +%s) | |
echo $((now-uptime)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo sysctl -w kern.sysv.shmmax=$((1048576 * 256)) | |
sudo sysctl -w kern.sysv.shmall=$((1048576 * 256)) | |
sysctl kern.sysv.shmmax | |
sysctl kern.sysv.shmget | |
cat /etc/sysctl.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: all | |
become: yes | |
tasks: | |
- name: ensure nginx is at the latest version | |
apt: name=nginx state=latest | |
- name: restart nginx | |
service: | |
name: nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install ec2_metadata | |
from ec2_metadata import ec2_metadata | |
ALLOWED_HOSTS = [ec2_metadata.public_ipv4,ec2_metadata.private_ipv4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DJANGO PRODUCTION SETTINGS | |
import logging | |
from boto3.session import Session | |
import os | |
from ._base_django import * | |
AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID') | |
AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY') | |
AWS_REGION_NAME = os.getenv('AWS_REGION_NAME') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker ps -q | xargs -r sudo docker stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get autoclean | |
sudo apt-get autoremove | |
sudo apt-get clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |