Python3 Asyncio implements an event loop, but in quite low level, it's missing some basic helpers that can make your life a lot easier.
The Pool and Group are typical missing ones. Compare these codes below
- without group
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $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 |
# ElasticSearch Service | |
description "ElasticSearch" | |
start on (net-device-up | |
and local-filesystems | |
and runlevel [2345]) | |
stop on runlevel [016] | |
respawn |
/* | |
Pretty Date script modified from John Resig here http://ejohn.org/blog/javascript-pretty-date | |
*/ | |
function relativeDateTime (tdate) { | |
var system_date; | |
if (typeof (tdate) === "number") { | |
tdate = new Date(tdate).toString(); | |
} | |
if (navigator.userAgent.match(/MSIE\s([^;]*)/)) { |
PS1="\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[01;31m\]\`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git:\1)/'\`\[\033[00m\]\$ " |
#!/bin/sh | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential python-dev libevent-dev libxslt-dev uuid-dev python-setuptools dtach libzmq-dev | |
apt-get -y install sysstat vnstat redis-server mysql-server | |
easy_install pip | |
pip install virtualenvwrapper | |
pip install cython | |
pip install zerorpc lxml requests pymongo mongoengine redis redisco fabric ipython sqlalchemy bottle django flask |
#!/usr/bin/env python | |
import gevent.monkey | |
gevent.monkey.patch_all() | |
import boto | |
import config | |
import gevent | |
import gevent.pool | |
import os |
// ---------------------------------------------------------- | |
// A short snippet for detecting versions of IE in JavaScript | |
// without resorting to user-agent sniffing | |
// ---------------------------------------------------------- | |
// If you're not in IE (or IE version is less than 5) then: | |
// ie === undefined | |
// If you're in IE (>=5) then you can determine which version: | |
// ie === 7; // IE7 | |
// Thus, to detect IE: | |
// if (ie) {} |
{ | |
"metadata": { | |
"name": "", | |
"signature": "sha256:f7fc0e66200bb5a9cae8e5e59abfaa99691caa881252e9266f11e7cffc7dafe6" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ |