Instantly share code, notes, and snippets.

View ssl.txt
# create the cert key request
openssl req -newkey rsa:2048 -nodes -keyout domain.com.key -out domain.com.csr
# concat the bundle and certs
cat domain_com.crt domain_com.ca-bundle > website-bundle.crt
# SSL checker for after install
https://www.sslshopper.com/ssl-checker.html
View docker.txt
# view container instances
sudo docker container ls
# activate
sudo docker exec -i -t be821b60fa28 /bin/bash
View remote-my-sql-ec2-etc.txt
# UPDATE AWS EC2 SECURITY GROUPS FIRST TO ALLOW MySQL CONNECTION VIA IP
---
# Edit /etc/mysql/my.cnf, and change the binding address to 0.0.0.0
bind-address = 0.0.0.0
# then restart mysql server
$ sudo /etc/init.d/mysql restart
View default
# update the location blocks try_files in your /sites-available/default
location / {
try_files $uri $uri/ /index.html$is_args$args;
}
View mime.types
# add below to /etc/nginx/mime.types
application/x-font-ttf ttc ttf;
application/x-font-otf otf;
application/font-woff woff;
application/font-woff2 woff2;
application/vnd.ms-fontobject eot;
# add below to /sites/available/your-site
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
View cli.txt
# allow WP to FTP/access core/plugin folders
sudo chown -R www-data /var/www/html
# always set back when done
sudo chown -R sammy /var/www/html
# restart PHP on Ubuntu
sudo service php7.0-fpm restart
View gunicorn.sock
# Fix Gunicorn socket with Nginx not working
# create a new gunicorn sock (for nginx)
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#create-a-gunicorn-systemd-service-file
# NGINX - make sure same sock so nginx can talk to Gunicorn!
upstream app_server {
server unix:/home/django/django_project/MyAPIName/mysockname.sock fail_timeout=0;
}
View style.scss
// FIX BOOTSTRAP CAROUSEL WHITE-SPACE BETWEEN SLIDES
.carousel-item {
transition: -webkit-transform 0.5s ease !important;
transition: transform 0.5s ease !important;
transition: transform 0.5s ease, -webkit-transform 0.5s ease !important;
-webkit-backface-visibility: visible !important;
backface-visibility: visible !important;
}
View default
# full nginx conf for Django w/web-sockets
upstream app_server {
server 127.0.0.1:9000 fail_timeout=0;
}
upstream websocket {
server 127.0.0.1:8002 fail_timeout=0;
}
View urls.py
# place file in static root
from django.views.generic.base import RedirectView
from django.contrib.staticfiles.storage import staticfiles_storage
urlpatterns = [
url(r'C798C4F2FDD57D2D63BF76874C080F49.txt', RedirectView.as_view(
url=staticfiles_storage.url('C798C4F2FDD57D2D63BF76874C080F49.txt'),
permanent=True),