Skip to content

Instantly share code, notes, and snippets.

View puilp0502's full-sized avatar

Minseok Yang puilp0502

View GitHub Profile
@puilp0502
puilp0502 / install-uwsgi-nginx.sh
Last active January 15, 2018 07:42
Install uWSGI and nginx
#!/bin/bash
# uWSGI & nginx installation script
# Created at 2017-06-27 by Frank Yang (https://github.com/puilp0502)
# Tested on Ubuntu Server 16.04 LTS
# Check if user is root
if [[ $UID -ne '0' ]]; then
echo "This script needs to be run as root; exiting..."
exit 0
@puilp0502
puilp0502 / uwsgi.ini
Created June 26, 2017 15:37
Sample uwsgi ini configuration
[uwsgi]
# Django-related settings
# the base directory (full path)
chdir = /home/ubuntu/(project-dir)
# Django's wsgi file
module = (project-name).wsgi:application
# the virtualenv (full path)
home = /home/ubuntu/.venv/(venv-name)/
@puilp0502
puilp0502 / uwsgi.service
Created June 26, 2017 15:02
uwsgi emperor mode systemd definition
[Unit]
Description=uWSGI Emperor service
[Service]
RuntimeDirectory=uwsgi
RuntimeDirectoryMode=755
User=emperor
Group=www-data
ExecStart=/usr/local/bin/uwsgi --emperor /etc/uwsgi/sites
Restart=always
@puilp0502
puilp0502 / gen_secret.py
Created June 8, 2017 15:43
Generate django secret key
import random
import string
print("".join([random.SystemRandom().choice(string.digits + string.ascii_letters + string.punctuation) for i in range(50)]))
@puilp0502
puilp0502 / jupyterhub.service
Created November 24, 2016 15:31
systemd service file for Jupyterhub
#Assuming you followed the guide at https://github.com/jupyterhub/jupyterhub/wiki/Using-sudo-to-run-JupyterHub-without-root-privileges
[Unit]
Description=JupyterHub Server
[Service]
#replace with your jupyterhub running user
User=rhea
Group=rhea
WorkingDirectory=/etc/jupyterhub/
ExecStart=/usr/local/bin/jupyterhub --JupyterHub.spawner_class=sudospawner.SudoSpawner
@puilp0502
puilp0502 / install-pip.sh
Created September 5, 2016 12:02
install-pip.sh
echo "#### Installing setuptools... ####"
wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python > /dev/null
if [[ ! $? ]]; then
echo "Failed!"
exit 1
fi
echo "#### Installing pip... ####"
wget https://bootstrap.pypa.io/get-pip.py -O - | sudo python > /dev/null
if [[ ! $? ]]; then