很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。
每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。
原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。
另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。
#!/bin/sh | |
function _get_down_cmd(){ | |
echo "\"pget -n ${2} '${1}' -o ${3}\"" | |
} | |
if [[ $# -lt 1 ]]; then | |
echo "need down_url" | |
echo "$0 用法: $0 [OPTS] <down_url> [maxconn|number] [base|directory]" | |
exit 1 | |
fi |
s = [[1, 2, 3, 4], | |
[1, 2, 3, 5], | |
[1, 9, 4], | |
[10, 11, 12, 7], | |
[10, 12, 4, 5]] | |
c = {1:{2:{3:[4, 5]}, 9:[4]}, 10:{11:{12:[7]}, 12:{4:[5]}}} | |
r = {} |
.vagrant | |
Gemfile.lock | |
Berksfile.lock | |
tmp/ |
#!/usr/bin/python | |
#-*- coding:utf-8 -*- | |
""" | |
给定数字X和Y,返回其中包括多少个数字,数字本身是回文数,同时也是另一个回文数的平方。 | |
Given two numbers X and Y, return how many numbers in that range | |
(inclusive) are palindromes, and also the square of a palindrome. | |
""" | |
def get_numbers(deep): | |
if deep == 1: |
Out[27]: [u'Win32_TSClientSetting', u'Win32_Service', u'Win32_NTEventlogFile', u'CIM_LinkHasConnector', u'CIM_Service', u'Win32_LogicalShareAccess', u'CIM_DependencyContext', u'Win32_SystemNetworkConnections', u'Win32_PageFile', u'MSFT_WmiCoreUser', u'Win32_PerfFormattedData_PerfProc_Process', u'CIM_CreateDirectoryAction', u'MSFT_NetTakeOwnership', u'CIM_OSProcess', u'Win32_LogicalFileAuditing', u'Win32_ModuleTrace', u'Win32_SystemTimeZone', u'__ExtrinsicEvent', u'Win32_PerfRawData_PerfOS_Objects', u'Win32_SecuritySettingAuditing', u'__TimerInstruction', u'Win32_LUID', u'CIM_DiskPartition', u'Win32_PerfRawData_PSched_PSchedFlow', u'Win32_SystemLogicalMemoryConfiguration', u'Win32_IniFileSpecification', u'Win32_SoftwareFeature', u'Win32_ReserveCost', u'Win32_ThreadTrace', u'MSFT_NetServiceStartFailedNone', u'Win32_TapeDrive', u'Win32_SubDirectory', u'Win32_PerfRawData_Tcpip_NetworkInterface', u'MSFT_WmiCoreLogoffEvent', u'Win32_SystemConfigurationChangeEvent', u'Msft_WmiProvider_CreateClassEnumAsyncEvent_Pre', |
#.NET
http://stackoverflow.com/questions/954764/good-net-based-cms http://space.itpub.net/82080/viewspace-626939 http://www.hualay.net/blog/Bloger-Wikipedia/106/106.html
##Orchard Orchard is a free, open source, community-focused project aimed at delivering applications and reusable components on the ASP.NET platform. It will create shared components for building ASP.NET applications and extensions, and specific applications that leverage these components to meet the needs of end-users, scripters, and developers. Additionally, we seek to create partnerships with existing application authors to help them achieve their goals. Orchard is delivered as part of the ASP.NET Open Source Gallery under the Outercurve Foundation. It is licensed under a New BSD license, which is approved by the OSI. The intended output of the Orchard project is three-fold:
Individual .NET-based applications that appeal to end-users , scripters, and developers
#!/usr/bin/env python2 | |
#-*- coding:utf-8 -*- | |
""" | |
用来抓取 ikandou.com 网站信息的脚本 | |
需要安装 mongodb 数据库. | |
- pymongo 用于存储数据库 | |
- requests 方便的读取页面 | |
- pyquery 使用jquery 的语法来控制网页和xml, 其基于lxml | |
- lxml |
60261 PHP经典实例 | |
28526 史蒂夫·乔布斯传 | |
27804 拖延心理学 | |
26647 明朝那些事儿(1-9) | |
22816 Steve Jobs | |
22395 百年孤独 | |
21999 金庸全集三联版 | |
21238 中国历代政治得失 | |
20224 不二 | |
19241 三体 |
def checkio(n): | |
'return roman numeral using the specified integer value from range 1...3999' | |
if 1 <= n <= 3999: | |
return ''.join(to_roman(n)) | |
def to_roman(num): | |
roman = [["","I","II","III","IV","V","VI","VII","VIII","IX"], |