自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(35)
  • 资源 (2)
  • 收藏
  • 关注

ubuntu安装mysql异常处理

start: Job failed to startinvoke-rc.d: initscript mysql, action "start" failed.dpkg: error processing mysql-server-5.5 (--configure): subprocess installed post-installation script returned error...

2014-05-30 22:31:17 213

添加EPEL源

Install the extra repositories[code="shell"]Centos 5.xwget [url]http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm[/url]wget [url]http://rpms.famillecollet.com/enterpr...

2014-05-11 09:25:43 169

python 字典的扩展变形

[code="python"]class AttrDict(dict): """ http://stackoverflow.com/questions/4984647/\ accessing-dict-keys-like-an-attribute-in-python http://bugs.python.org/issue1469629...

2013-10-21 09:02:47 227

原创 geohash的应用 附近地址搜索

[url]http://en.wikipedia.org/wiki/Geohash[/url]简单使用 geohash, redis,bottle, python-geohash 来实现 restful api的地理位置附近人搜素[code="python"]from bottle import Bottle, runimport timeimport jsonfr...

2013-08-16 11:17:59 213

原创 openstack swift GB/month

[url]http://www.buildcloudstorage.com/2012/01/can-openstack-swift-hit-amazon-s3-like.html[/url][img]http://dl.iteye.com/upload/attachment/0078/7974/9b8ad223-31a8-3d18-9ade-b732f29e5f23.png[/img]...

2013-01-04 12:06:16 86

原创 swift benchmark 转载

具体测试移步到下面的blog URL[url]http://www.zmanda.com/blogs/?tag=swift-benchmark[/url][img]http://dl.iteye.com/upload/attachment/0078/4068/d0805a48-3223-32dc-89cf-602dffe3cb11.jpg[/img][img]http://...

2012-12-26 11:09:07 108

原创 openstack-folsom-architecture 记录

[img]http://dl.iteye.com/upload/attachment/0078/4025/736ddf24-4c01-34c5-89ee-10b28e17ffed.jpg[/img][img]http://dl.iteye.com/upload/attachment/0078/4031/ef16191e-dadb-328c-bd12-c868ea5e57a5.jpg[/...

2012-12-26 10:34:48 78

puppet 笔记

compile puppet scrippuppet apply modules/flume/manifests/init.pp --modulepath modules/flume/[root@hz-ci-05 modules]# puppet master --configprint modulepath/etc/puppet/modules:/usr/share/pu...

2012-12-24 12:37:39 88

原创 An Introduction to the Python Web Server Gateway Interface

非原创,来源互联网In BriefWSGI is a specification, laid out in PEP 333, for a standardized interface between Web servers and Python Web frameworks/applications.The goal is to provide a relatively...

2012-12-05 13:51:28 100

openstack swift Cluster Health and Telemetry

之前看swift的code主要关注在ring,proxy-server, object-server, container-server, account-server这些组件上,一次有人问我swift如何monitoring的,哦,fuck 我漏了这里,不过我想swift使用WSGI应该比较容易在filter加一个 侦测状态的filter_factory 到原有的WSGI的Pipeline,马上...

2012-12-04 17:55:54 100

swift monitoring by swift-dispersion-*

1. 处理系统更新 建议每次都以一个zone为单位进行系统更新和重启。以这种方式进行更新,能使Swift集群保 持可使用和可响应的状态。另一个更新zone的明智的做法是,更新完一个zone时,先让其运行一段时间以保证之前的更新没有导致不利的反应,然后再进行下次更新2. 处理磁盘错误 当一个磁盘出现错误,第一步要先确保将此盘unmounted,这可使swift更容易地应对此...

2012-12-04 17:32:02 114

paste deploy python ini 配置文件简单说明

配合 [url]http://www.python.org/dev/peps/pep-0333/[/url][url]http://pythonpaste.org/deploy/[/url]看下面的example(从网络上改造而来,出处URL也搞忘记的),很快会对python的paste如何组织wsgi有一个简单的了解,pastedeploylab.ini[code="py...

2012-12-03 13:27:07 115

原创 基于用户投票排序算法reddit(转载)

留下笔记,原文:http://amix.dk/blog/post/19588(转载:http://blog.jobbole.com/15727/)Reddit是美国最大的网上社区,它的每个帖子前面都有向上和向下的箭头,分别表示”赞成”和”反对”。用户点击进行投票,Reddit根据投票结果,计算出最新的”热点文章排行榜”。怎样才能将赞成票和反对票结合起来,计算出一段时间内最受...

2012-03-21 14:23:54 239

原创 python 反射

如何在python中实现 类似java中,[code="java"]Class.forName().newInstance()[/code]的功能1. 静态导入[code="python"]tommy@ubuntu:~$ pythonPython 2.7.2+ (default, Oct 4 2011, 20:03:08)[GCC 4.6.1] on linux2Type...

2012-03-20 10:31:45 101

原创 如何友好的 监控与管理 Linux 进程

在做视频编解码的程序,需要fork子进程去调用转码的tools做encode, 这里面就需要能很好的控制进程,让进程类似于跑在沙漏里面,安全,可控的运行,实现进程的管理接口,其实比较简单的,所有的进程信息来源,均来自 /proc 文件系统因为是所有进程相关的信息都是通过读取内存proc文件系统,所以没有任何性能问题,[code="bash"]tommy@tommy-desk...

2010-11-11 12:57:48 171

原创 Linux 文件删除机制

多进程环境下,打开同一个文件,进行读写操作过程中,如果其中一个进程删除这个文件,那么,另外正在读写这个文件会发生什么呢?1. 正在读写的进程发生异常,因为文件被删除了2. 正在读写的进程仍然正常读写,好像没有发现发生了什么我要告诉你的是,在linux环境上,答案2是对的,但是当正在读写的进程退出后,这个文件谁也不能再读写了,或者说,这个文件被删除了解析如下:Linux 是通过 ...

2010-11-10 22:39:54 229

原创 Webpy + Nginx with FastCGI

Requirements * Nginx 0.8.* or 0.7.* (with fastcgi and rewrite module). * Webpy 0.32 * Spawn-fcgi 1.6.2 * FlupOlder versions may work, but aren't tested.Resources * N...

2010-11-10 16:50:59 504

worker pool

[url]http://celeryq.org/[/url][b]Overview[/b]This is a high level overview of the architecture.[img]http://cloud.github.com/downloads/ask/celery/Celery-Overview-v4.jpg[/img]he broker d...

2010-09-27 17:28:14 82

原创 sandbox for python

遇到一台机器上部署多个不同的python程序,管理其之间import不同的libs而麻烦[url]http://virtualenv.openplans.org/[/url]virtualenv通过隔离包目录和系统环境参数来实现多个相对独立的虚拟环境。这样可避免过多的第三方库因版本依赖造成问题。同时每个独立的虚拟环境只需通过打包即可分发,方便了系统部署。1. 安装...

2010-09-27 14:47:42 191

原创 python get host ip socket

[code="python"][root@CT53-64-BASE tools]# pythonPython 2.4.3 (#1, Sep 3 2009, 15:37:37)[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2Type "help", "copyright", "credits" or "license" for more...

2010-08-11 08:57:26 95

原创 unix时间戳和时间转换

[code="python"]jsonkey@ubuntu:~/health$ pythonPython 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2Type "help", "copyright", "credits" or "license" for ...

2010-06-29 22:07:19 73

原创 整数转换成二进制

[code="python"]>>> bin = lambda n : (n > 0) and (bin(n/2) + str(n%2)) or ''>>> bin(1)'1'>>> bin(20)'10100'>>>[/code]

2010-05-20 09:25:53 87

python获得磁盘剩余空间 statvfs

在linux上工作大家都会用到df命令[code="linux"][tommy@tommy-1 ~]$ df -hFilesystem Size Used Avail Use% Mounted on/dev/sda5 4.8G 389M 4.2G 9% //dev/sda7 271G 3.5G ...

2010-04-01 14:43:40 573

python 监控 linux memory 使用率

定时获得服务器上内存的使用率linux的内存使用跟win是不一样的,以下linux命令获得内存使用率是,linux os 预先分配的,实际上可能还没有使用这么多内存,可以使用 [code="python"]$free -m total used free shared buffers cachedMem...

2009-11-09 13:30:39 188

python 监控 linux cpu 使用率

最近一个应用特别的吃cpu,又是和已有的应用复用机器,故所以对机器的cpu监控显的重要起来当cpu高到某一限度,及时报警[code="python"] def _read_cpu_usage(self): """Read the current system cpu usage from /proc/stat.""" try: ...

2009-11-09 13:18:56 312

mplayer ffmpeg 分析 媒体文件 的 信息 metadata

1. 使用 mplayer分析多媒体文件信息mplayer -identify -frames 5 -endpos 0 -vo null YOU-FILEMPlayer SVN-r29319-4.3.2 (C) 2000-2009 MPlayer TeamPlaying onepiece.mp4.libavformat file format detected.I...

2009-07-29 10:56:37 381

mplayer ffmpeg 编译 static

目前开源的转码工具主要有 mplayer & ffmpeg本篇介绍搭建转码环境(linux平台环境)1. mplayer[url]http://www.mplayerhq.hu/design7/dload.html[/url]configure[code="c"]./configure --enable-runtime-cpudetection --en...

2009-07-27 20:04:34 184

python异常捕获try except

python的异常处理机制设计的比较传统,在日常的开发中,基本满足我的需要下面就python的异常,几点小小的讨论1. try...except[code="python"]tommy@lab3:~$ pythonPython 2.5.2 (r252:60911, Jan 4 2009, 17:40:26)[GCC 4.3.2] on linux2Type "he...

2009-06-29 13:14:38 92

python adodb 支持mysql非标准端口

python对数据库的操作大多是基于MySQLdb 模块[url]http://mysql-python.sourceforge.net/[/url]但是,一般情况下大家都很少直接去调用 MySQLdb 去操作数据库大多会借助adodb[url]http://phplens.com/lens/adodb/adodb-py-docs.htm[/url]...

2009-06-14 19:08:05 108

python安全管理子进程-subprocess

经常会用到python去调用外部 工具或者命令去干活有的时候子进程并不按预期退出比如,子进程由于某种原因挂在那里,这时候也许,我们有这样一种需求:需要父进程对子进程有监控动作,即,超过一定的时间,就不再等待子进程自己退出,而是去kill子进程,回收资源以下会列出几张实现方法1.os.system[url]http://docs.python.or...

2009-06-10 20:14:59 341

lighttpd对flv视频文件的拖动一种变形

当前流行的视频网站,关于视频的在线拖动观看技术的小试,1.flv文件 flv视频文件,想大家都比较清楚,只要从关键帧的位置切开,并加上"FLV\x1\x1\0\0\0\x9\0\0\0\x9"公共头标志信息,后对任何支持flv视频文件dencoder的播放器都是可以正常播放的 "FLV\x1\x1\0\0\0\x9\0\0\0\x9" + keyframe(body)...

2009-05-08 15:04:13 132

python操作mysql插入中文问题

最近碰到python向mysql插入中文乱码的问题SQL_H_UPDATE_DELTA_ITEM = “INSERT INTO delta_item SET hostname=’%(_hostname)s’, itemID=%(_itemID)s, title=%(_title)s, copyright=%(_copyright)s WHERE itemID = %(_itemID)s”#...

2009-05-07 11:58:44 159

pycurl

最近在做一个性能测试,主要是http协议的,开始想到用C的线程,在后来的试验中发现,C开发多线程还是比较麻烦的,后来,想到了python,因为是http下载,curl的libcurl[code="python"]def run(self): real_uri=self.get_real_url() if not real_uri: ...

2009-05-07 11:56:54 74

lighttpd防盗链技术的一个变形

lighttpd 中的mod_secure_download.c模块中的防盗链技术大家已经很清楚了,但是这个模块要求会改写一些url的地址,形如:[code="c"]The generated URL has to have the format:/// which looks like "yourserver.com/bf32df9cdb54894b22e09d0ed87326fc/...

2009-05-06 14:37:08 152

mencoder转flv

近来使用mencoder转码,统一转换成flv格式本来想在仔细阅读man之前,先总体上感受一下这个大胃的mencodergoogle一把后,发现,网络上基本上使用的命令是mencoder -quiet -oac mp3lame -lameopts abr:br=48 -srate 22050 -af channels=2 -ovc lavc -vf hqdn3d,scale...

2009-05-06 11:14:17 91

lex+yacc

学习 lex & yacc的中文手册<br>好东西哦

2007-09-03

dmalloc

dmallc手册,对malloc & free check

2007-09-03

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除