Skip to content

Instantly share code, notes, and snippets.

@newphp
newphp / daemon2.py
Created December 17, 2012 15:45
python2版本进程控制脚本daemon2.py
#!/usr/bin/env python
import sys, os, time, atexit
from signal import SIGTERM
class Daemon:
"""
A generic daemon class.
Usage: subclass the Daemon class and override the run() method
@newphp
newphp / varnish
Last active December 10, 2015 00:58
/etc/sysconfig/varnish
# Configuration file for varnish
#
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this
# shell script fragment.
#
# Maximum number of open files (for ulimit -n)
NFILES=131072
# Locked shared memory (for ulimit -l)
@newphp
newphp / varnish.vcl
Last active December 10, 2015 00:58
/etc/varnish/default.vcl
#
backend default {
.host = "127.0.0.1";
.port = "80";
.connect_timeout = 1s;
.first_byte_timeout = 30s;
}
backend siteapp {
.host = "10.4.83.14";

Using the optional jQuery plug-in

A jQuery plug-in exists that wraps the native Fine Uploader code. If you would like to reap all of the benefits that a jQuery plug-in offers, such as use of jQuery Events, specifying elements using the jQuery object/jQuery selectors, easy integration into your otherwise jQuery project: look no further!

To use the jQuery plug-in, ensure you include the proper Fine Uploader js file on your page, and instantiate it like so:

$('#fineUploaderElementId').fineUploader({
    request: {
 endpoint: '/upload/endpoint'
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/logs/httpd.pid
# config: /usr/local/apache/conf/httpd.conf
ServerName "ProFTPD"
ServerType standalone
DefaultServer on
Port 21
PassivePorts 35000 35999
UseIPv6 off
Umask 022
User nobody
Group nobody
upstream some_app_server {
server 127.0.0.1:9393;
}
server {
listen 80;
server_name my-upload-endpoint.com ;
<?php
/*------------------------------------------------------------------------------
** File: class.magic-min.php
** Class: MagicMin
** Description: Javascript and CSS minification/merging class to simplify movement from development to production versions of files
** Dependencies: jsMin (https://github.com/rgrove/jsmin-php)
** Version: 2.5
** Created: 01-Jun-2013
** Updated: 18-Jun-2013
** Author: Bennett Stone
@newphp
newphp / install-shadowsocks-libev.sh
Created July 12, 2014 21:43
shadowsocks-libev one click install shell script for CentOS
#! /bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===============================================================================================
# System Required: CentOS6.x (32bit/64bit)
# Description: Install Shadowsocks(libev) for CentOS
# Author: Teddysun <i@teddysun.com>
# Intro: http://teddysun.com/357.html
#===============================================================================================
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;