Skip to content

Instantly share code, notes, and snippets.

python项目通用组件和基础服务

很多公司都大量使用了python,其中有一些开发规范,code guidline, 通用组件,基础框架是可以共用的。

每个公司都自己搞一套, 太浪费人力,我想开一帖和大家讨论一下这些python基础设施的搭建。

原则是我们尽量不重新发明轮子,但开源组件这么多,也要有个挑选的过程和组合使用的过程,在这里讨论一下。

另一方面,有些开源组件虽然强大,但我们不能完全的驾驭它,或只使用其中很少的一部分,我们就可以考虑用python实现一个简单的轮子,可控性更强,最好不要超过300行代码。

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',
@luw2007
luw2007 / gist:5590896
Last active December 17, 2015 09:58
http://www.oschina.net/code/snippet_1026590_20768 给定数字X和Y,返回其中包括多少个数字,数字本身是回文数,同时也是另一个回文数的平方。 可能边界还存在问题,但是没有过多的用例验证.
#!/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:
.vagrant
Gemfile.lock
Berksfile.lock
tmp/
@luw2007
luw2007 / simple_list.py
Created June 21, 2013 02:04
acmerfight 通过“googlegroups.com” 发送至 python-cn 有一个文件 下面为文件中的前5行数据,注意每行数据存储的元素数量不固定 [1, 2, 3, 4] [1, 2, 3, 5] [1, 9, 4] [10, 11, 12, 7] [10, 12, 4, 5] 我要明确知道上一级到下一级的完整从属关系。 要求输出结果为 {1:{2:{3:[4, 5]}, 9:[4]}} {10:{11:{12:[7]}, 12:{4:[5]}}}
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 = {}
@luw2007
luw2007 / lftpdown
Last active December 18, 2015 18:59
利用lftp 多点下载。例子lftpdown https://index.docker.io/v1/repositories/base/images 30 base.img
#!/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
@luw2007
luw2007 / 词性标记.md
Last active March 18, 2024 06:36
词性标记: 包含 ICTPOS3.0词性标记集、ICTCLAS 汉语词性标注集、jieba 字典中出现的词性、simhash 中可以忽略的部分词性

词的分类

  • 实词:名词、动词、形容词、状态词、区别词、数词、量词、代词
  • 虚词:副词、介词、连词、助词、拟声词、叹词。

ICTPOS3.0词性标记集

n 名词

nr 人名

?
@luw2007
luw2007 / sdo_cname
Last active December 23, 2015 03:59
sdo_cname
178.sdo.com
ac.sdo.com
act.mxd.sdo.com
adrs.sdo.com
aion.sdo.com
analytics.sdo.com
bbs.gui.sdo.com
bbs.sdch.sdo.com
bnb.sdo.com
cal.sdo.com
@luw2007
luw2007 / requiretment.md
Created September 16, 2013 08:03
requiretment.md

#需求分析

##探索

  • 自动探索,每日密境 > 活动密境 > 固定密境
  • 计算升级时间

##妖精战

  • 舔妖
  • 计算是否秒掉
  • 吃BC 秒觉醒