Skip to content

Instantly share code, notes, and snippets.

see gunicorn logs:

sudo journalctl -u gunicorn

@royz
royz / django_deploy.md
Last active August 21, 2020 19:03 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 20.04

These steps should work on any previous or future version of ubuntu as well

Software

Update packages

import sys
import logging
from logging.handlers import RotatingFileHandler
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s',
handlers=(
RotatingFileHandler(
filename='logs.log',

**root required

  1. add your cert normally, it will be stored in your personal store and android will ask you a pin/password... Proceed

  2. With a file manager with root capabilities, browse files in /data/misc/user/0/cacerts-added or /data/misc/keychain/cacerts-added. You should see a file here, it's the certificate you have added at step 1.

  3. Move this file to system/etc/security/cacerts

@royz
royz / node_nginx_ssl.md
Last active August 24, 2021 15:14 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@royz
royz / send_mail_via_gmail.py
Last active November 22, 2020 16:30
Send email via gmail with Python3
import config
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def send_mail(subject, message):
try:
message = MIMEMultipart()
message['From'] = config.sender_email
message['To'] = config.recipient_email
@royz
royz / install_mongodb.md
Created January 31, 2021 17:11
Install MongoDb on ec2 and configure authentication for remote access

Install MongoDb on ec2 and configure authentication for remote access

1. Install and start mongo service [official docs]

1.1 Import the public key used by the package management system

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
@royz
royz / .bashrc
Last active April 8, 2022 19:09
#!/bin/bash
# enable color support of ls
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
setInterval(() => {
document.querySelectorAll(".circular.style-scope.yt-icon-button")[12].click();
document.querySelectorAll(".style-scope.ytd-menu-popup-renderer")[3].click();
}, 500);
@royz
royz / ubuntu-sys-info.md
Created November 12, 2021 03:17
show sys info on ubuntu (like the one after startup)
. /etc/update-motd.d/50-landscape-sysinfo