Skip to content

Instantly share code, notes, and snippets.

View puilp0502's full-sized avatar

Frank Yang puilp0502

View GitHub Profile
@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
@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 / 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 / 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 / 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 / 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
0x56e292a201c0cfFC3c7b008cc4d572D7F82AA733

Keybase proof

I hereby claim:

  • I am puilp0502 on github.
  • I am iamfranksheep (https://keybase.io/iamfranksheep) on keybase.
  • I have a public key ASCIwckgEM-HLNx4tVTIqfOc0O7zM0zI_HxEAHphHvNw2wo

To claim this, I am signing this object:

pragma solidity ^0.4.0;
contract KVStore {
mapping(uint64 => string) public map;
function set(uint64 key, string value) public {
map[key] = value;
}
function get(uint64 key) public view returns (string) {
return map[key];
@puilp0502
puilp0502 / install_docker.sh
Last active February 16, 2021 15:34
Docker installation script
#!/bin/sh
# Docker CE Installation Script
# Based on https://docs.docker.com/install/linux/docker-ce/ubuntu
# Uninstall old versions
sudo apt-get remove docker docker-engine docker.io containerd runc
# Setup the repositories
sudo apt-get update
sudo apt-get install -y \