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 / 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 / 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
@tiancheng91
tiancheng91 / crawler.py
Created April 21, 2016 08:14 — forked from jmoiron/crawler.py
Simple gevent/httplib2 web crawler.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple async crawler/callback queue based on gevent."""
import traceback
import logging
import httplib2
import gevent
@tiancheng91
tiancheng91 / .env
Created July 9, 2016 15:09
常用环境变量
HOSTNAME=ip-72-167-112-17.ip.secureserver.net
RUBYPATH=/usr/bin
SHELL=/bin/bash
TERM=xterm
HISTSIZE=1000
SSH_CLIENT=122.169.131.179 1742 22
SSH_TTY=/dev/pts/1
USER=amrood
JRE_HOME=/usr/java/jdk/jre
J2RE_HOME=/usr/java/jdk/jre