Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#import <Foundation/Foundation.h> | |
// clang -g -Wall -fobjc-arc -framework Foundation -o serial serial.m | |
static id makePlistObjects (void) { | |
NSMutableDictionary *top = [NSMutableDictionary dictionary]; | |
[top setObject: @"Hi I'm a string" forKey: @"string"]; | |
[top setObject: [NSNumber numberWithInt: 23] forKey: @"number"]; |
// answer to http://weibo.com/1915548291/z2UtyzuvQ | |
// see also http://www.cnblogs.com/baiyanhuang/archive/2012/11/11/2764914.html | |
#include <boost/bind.hpp> | |
#include <boost/function.hpp> | |
#include <boost/noncopyable.hpp> | |
#include <boost/ptr_container/ptr_vector.hpp> | |
#include <fstream> | |
#include <iostream> |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
#! /bin/bash | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
#! /usr/bin/env python | |
# coding=utf-8 | |
__author__ = 'jszhou' | |
from bottle import * | |
import hashlib | |
import xml.etree.ElementTree as ET | |
import urllib2 | |
# import requests | |
import json |
#models.py | |
class Task(models.Model): | |
title = models.CharField(max_length=255) | |
description = models.TextField() | |
def __unicode__(self): | |
return self.title | |
import os | |
import imp | |
def importFromURI(self, uri, absl=False): | |
if not absl: | |
uri = os.path.normpath(os.path.join(os.path.dirname(__file__), uri)) | |
path, fname = os.path.split(uri) | |
mname, ext = os.path.splitext(fname) | |
no_ext = os.path.join(path, mname) |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
本文基本上这为两篇文章的翻译和整合 -- Scalable networking And Why are event-driven server so great
传统服务器模型如Apache为每一个请求生成一个子进程。当用户连接到服务器的一个子进程就产生,并处理连接。每个连接获得一个单独的线程和子进程。当用户请求数据返回时,子进程开始等待数据库操作返回。如果此时另一个用户也请求返回数据,这时就产生了阻塞。
这种模式在非常小的工作负荷是表现良好,当请求的数量变得太大是服务器会压力过于巨大。 当Apache达到进程的最大数量,所有进程都变得缓慢。每个请求都有自己的线程,如果服务代码使用PHP编写时,每个进程所需要的内存量是相当大的[1]。
--- | |
version: 1 | |
disable_existing_loggers: False | |
formatters: | |
simple: | |
format: "%(name)-20s%(levelname)-8s%(message)s" | |
handlers: | |
console: | |
class: logging.StreamHandler | |
level: DEBUG |