Full-page background made with JavaScript and Canvas: the animation follows movement on non-touch devices
Forked from Marco Guglielmelli's Pen Animated Background.
Full-page background made with JavaScript and Canvas: the animation follows movement on non-touch devices
Forked from Marco Guglielmelli's Pen Animated Background.
These rules are adopted from the AngularJS commit conventions.
| #!/bin/bash | |
| # How to install PHP memcached on CentOS 6.5 | |
| # Install dependencies | |
| yum install cyrus-sasl-devel zlib-devel gcc-c++ | |
| # Get the latest libmemcached | |
| wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz | |
| tar -xvf libmemcached-1.0.16.tar.gz |
| from gevent import monkey | |
| monkey.patch_socket() | |
| import logging | |
| import gevent | |
| from gevent.queue import Queue | |
| import pymysql as db | |
| logging.basicConfig(level=logging.DEBUG) | |
| LOGGER = logging.getLogger("connection_pool") |
| # -*- coding: utf-8 -*- | |
| from twisted.enterprise import adbapi | |
| from twisted.python import log | |
| import MySQLdb | |
| import itertools | |
| class ReconnectingMixin: | |
| """MySQL 重新连接时, ConnectionPool 可以正确执行指定的操作,流程是: | |
| - 执行操作 |
| ;; Usage Example: | |
| ;; | |
| ;; <!-- BEGIN RECEIVE ORGTBL ${1:YOUR_TABLE_NAME} --> | |
| ;; <!-- END RECEIVE ORGTBL $1 --> | |
| ;; | |
| ;; <!-- | |
| ;; #+ORGTBL: SEND $1 orgtbl-to-gfm | |
| ;; | $0 | | |
| ;; --> |
分布式系统的核心是分布式通信,而传统上开发一套支持上千台规模集群,可靠性非常高的分布式通信框架,需要不少的精力投入。而在多数情景下,我们(特别是时间宝贵的OP)并不是非常关注技术实现的细节,而是希望有一套成熟、轻量、可靠性高、使用方便而且易于调试的分布式通信框架,可以直接使用,从而把时间放在具体业务逻辑上。
在PyCon 2012大会上,dotcloud公司开源了一套基于ZeroMQ和MessagePack的分布式通信框架(或者说是协议+Python实现)。该框架因为基于ZeroMQ,使用方法是RPC,所以被命名为ZeroRPC。ZeroRPC的特点在其官网的介绍中一目了然[1]:
ZeroRPC is a light-weight, reliable and language-agnostic library for distributed communication between server-side processes.
| #!/bin/bash | |
| # Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ | |
| # Install stuff # | |
| ################# | |
| # Install development tools and some misc. necessary packages | |
| yum -y groupinstall "Development tools" | |
| yum -y install zlib-devel # gen'l reqs |
| """ | |
| This is a simple example of WebSocket + Tornado + Redis Pub/Sub usage. | |
| Do not forget to replace YOURSERVER by the correct value. | |
| Keep in mind that you need the *very latest* version of your web browser. | |
| You also need to add Jacob Kristhammar's websocket implementation to Tornado: | |
| Grab it here: | |
| http://gist.github.com/526746 | |
| Or clone my fork of Tornado with websocket included: | |
| http://github.com/pelletier/tornado | |
| Oh and the Pub/Sub protocol is only available in Redis 2.0.0: |