Skip to content

Instantly share code, notes, and snippets.

worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@tiancheng91
tiancheng91 / iptables_rules_simple
Last active March 4, 2017 04:29
iptables simple
# 1. Delete all existing rules
iptables -F
iptables -X
# 2. Set default chain policies
iptables -P INPUT DROP
# 3. Allow ssh
iptables -A INPUT -i eth0 -p tcp --dport 9022 -m state --state NEW,ESTABLISHED -j ACCEPT
@tiancheng91
tiancheng91 / nginx_laravel.conf
Last active August 29, 2015 14:14
nginx config for laravel app
server{
listen 80;
server_name laravel.com;
root /root/laravel/public;
index index.php index.html;
location / {
location /static/ {
access_log off;
expires 10d;
@tiancheng91
tiancheng91 / mysql_low.cnf
Created March 9, 2015 02:02
mysql config for low memory vps
[mysqld]
# datadir = /var/lib/mysql
max_connections = 100
# wait_timeout = 180
# connect_timeout = 180
performance_schema = 0
# Maximum allowed size for a single HEAP (in memory) table. This option
@tiancheng91
tiancheng91 / osx.sh
Last active June 3, 2018 14:10
初始化脚本
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew tap caskroom/drivers
brew tap caskroom/versions
brew tap homebrew/core
brew tap homebrew/services
# set mirror
cd "$(brew --repo)"
@tiancheng91
tiancheng91 / jsonhandler.py
Last active August 29, 2015 14:26 — forked from mminer/jsonhandler.py
A JSON request handler for Tornado.
import json
import tornado.web
class JsonHandler(BaseHandler):
"""Request handler where requests and responses speak JSON."""
def prepare(self):
# Incorporate request JSON into arguments dictionary.
if self.request.body:
try:
@tiancheng91
tiancheng91 / 01_Laravel 5 Simple ACL manager_Readme.md
Created November 13, 2015 01:31 — forked from amochohan/01_Laravel 5 Simple ACL manager_Readme.md
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@tiancheng91
tiancheng91 / bash.sh
Last active November 30, 2015 07:46
常用脚本
# pip重新安装所有包
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U