很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。
每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。
原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。
另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。
| //scalaVersion 2.9.2 | |
| //akkaVersion 2.0.1 | |
| import akka.actor._ | |
| import java.net.InetSocketAddress | |
| import akka.util.ByteString | |
| import java.net.Socket | |
| import akka.actor.IO.SocketHandle | |
| import akka.actor.IO._ | |
| import akka.routing.RoundRobinRouter |
| import akka.actor.IO._ | |
| import akka.actor.{Props, IO, IOManager, Actor, ActorSystem} | |
| import akka.event.Logging | |
| import akka.util.ByteString | |
| import java.net.InetSocketAddress | |
| class TCPEchoServer(port: Int) extends Actor { | |
| val log = Logging(context.system, this) | |
| val state = IterateeRef.Map.async[IO.Handle]()(context.dispatcher) |
| --- openvpn-2.2.2.orig/options.c 2011-12-14 00:58:56.000000000 +0800 | |
| +++ openvpn-2.2.2/options.c 2012-12-21 10:44:57.683130505 +0800 | |
| @@ -54,6 +54,10 @@ | |
| #include "memdbg.h" | |
| +extern char* _socket_obfs_salt; | |
| +extern int _socket_obfs_salt_len; | |
| +extern int _socket_obfs_padlen; | |
| + |
| 王 | |
| 江 | |
| 周 | |
| 胡 | |
| 刘 | |
| 李 | |
| 吴 | |
| 毛 | |
| 温 | |
| 习 |
| # -*- coding: utf-8 -*- | |
| # Author: Douglas Creager <dcreager@dcreager.net> | |
| # This file is placed into the public domain. | |
| # Calculates the current version number. If possible, this is the | |
| # output of “git describe”, modified to conform to the versioning | |
| # scheme that setuptools uses. If “git describe” returns an error | |
| # (most likely because we're in an unpacked copy of a release tarball, | |
| # rather than in a git working copy), then we fall back on reading the | |
| # contents of the RELEASE-VERSION file. |
| function git_prompt_info() { | |
| ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
| echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_SUFFIX" | |
| } |
| *.pyc | |
| /bin | |
| /include | |
| /lib |
| import sys | |
| from gevent import server | |
| from multiprocessing import Process, current_process, cpu_count | |
| def note(format, *args): | |
| sys.stderr.write('[%s]\t%s\n' % (current_process().name, format%args)) | |
| def echo(socket, address): | |
| print 'New connection from %s:%s' % address |