- 博客(10)
- 收藏
- 关注
原创 WIN8学习日记1
Win8商店应用程序(Windows Store apps)开发,有如下方式: 1:Javascript + Html5 2:C#/C++/VB + XAML 我选择Javascript来开发,理由是对其他语言不熟悉。 首先创建一个默认的空白app 会产生几个默认文件: 1:default.html //这个是起始页面 2:default.js //def...
2013-07-05 17:59:17 75
原创 随机提取列表里的值
[code="python"] def ranList(l = []): while l: yield l.pop(random.randint(0, len(l)-1)) [/code]
2013-04-03 13:51:36 286
原创 新浪SEA_普通开发者免推荐认证活动
[code="python"] #coding=utf-8 def alive(m, n): a = range(m) while len(a)>1: b = (n%len(a) and n%len(a) or min(len(a), n))-1 yield "%d is died" % a[b] a = a[b+1:]...
2013-03-26 11:27:38 114
原创 批量KILL进程
[code="shell"] ps aux| grep datafenxi| grep -v grep| awk '{print $2}'| xargs kill -9 [/code] ps aux 显示所有进程 grep datafenxi 查询含有datafenxi的进程 grep -v grep 去掉含有grep的进程 awk '{print $2}' 输出第二列,就是p...
2013-03-14 17:00:53 191
原创 定时取得进程内存并写入日志
[code="shell"] $ cat mem.sh #!/bin/bash LOGFILE="/xxx/mem.log" date +%Y-%m-%d" "%H:%M:%S >>$LOGFILE ps aux |grep 'bin/eas.py' |awk '{if($13~/^\w+$/){print $13,$4}}' >> $LOGFILE $ crontab -l ...
2013-03-14 12:06:08 118
原创 用Shell写的批量svnup小工具
[code="shell"] #!/bin/bash hl="datachart help job liansai live news odds soft zx kaijiang" host="500.com" for v in $hl do path="/home/www/html/$v.$host/html/" cd $path svn up done ...
2013-03-13 14:57:15 289
原创 python内存释放原则
[code="python"] def getInit(class_name): """动态加载模块""" resultmodule = __import__(class_name, globals(), locals(), [class_name]) resultclass = getattr(resultmodule, class_name) retu...
2013-03-13 14:55:15 799
原创 实现双向队列
[code="php"] class deque{ public $queue = array(); public $length = 0; public function rpop(){ $node = array_pop($this->queue); $this->countque(); return $node; } public func...
2013-03-12 16:12:05 119
原创 [转]python迭代,yield使用
前段时间在读trac 中wiki模块的源码的时候,发现了很多地方都使用了yiled这一关键词, 感觉是在需要返回某个值的地方通过yield来代替return, 不是很明白其用法,所以仔细研究下。 一个使用了yiled关键字的函数就不再是一个普通的函数了,而是一个生成器函数(generator function), 当函数被调用的时候将返回一个迭代器(iterato...
2013-03-05 11:40:02 91
原创 执行完毕python之后进入交互模式
[code="python"] import code interp = code.InteractiveConsole(globals()) interp.interact("") [/code]
2013-03-05 11:27:37 480
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人