个人转载
文章平均质量分 73
xluren
这个作者很懒,什么都没留下…
展开
-
Jinja2 example for generating a local file using a template
原文链接:https://pythonadventures.wordpress.com/archives/Here I want to show you how to generate an HTML file (a local file) using a template with theJinja2 template engine.Python source (proba.转载 2015-10-15 13:42:13 · 1149 阅读 · 0 评论 -
Understanding free command in Linux/Unix
free is a command which can give us valuable information on available RAM in Linux machine. But many new Linux users and admins misinterpret its output. In this post we will walk through its output fo转载 2015-06-02 17:02:39 · 541 阅读 · 0 评论 -
linux free 命令中的 buffer & free
Short answer: Cached is the size of the page cache. Buffers is the size of in-memory block I/O buffers. Cached matters; Buffers is largely irrelevant.Long answer: Cached is the size of the转载 2015-06-02 15:27:40 · 669 阅读 · 0 评论 -
What Is the Difference Between a Block, a Proc, and a Lambda in Ruby
原文链接:http://awaxman11.github.io/blog/2013/08/05/what-is-the-difference-between-a-block/感觉写的很清晰易懂,虽然不一定全面,但是我感觉还是蛮不错的,转载了下。What are blocks, procs, and lambdas?Coder Talk: Examples of clos转载 2015-05-17 21:21:59 · 934 阅读 · 0 评论 -
Python的垃圾回收机制深入分析
无聊的五一,蛋疼的五一。看书吧!转载,原文链接:http://www.jb51.net/article/52229.htm一、概述:Python的GC模块主要运用了“引用计数”(reference counting)来跟踪和回收垃圾。在引用计数的基础上,还可以通过“标记-清除”(mark and sweep)解决容器对象可能产生的循环引用的问题。通过“分代回收”(gener转载 2015-05-01 15:03:42 · 710 阅读 · 0 评论 -
difference between Python shallow copy and deep copy
A:Shallow copies duplicate as little as possible. A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individ转载 2015-05-01 13:07:56 · 825 阅读 · 0 评论 -
Class method differences in Python: bound, unbound and static
原文出处:http://stackoverflow.com/questions/114214/class-method-differences-in-python-bound-unbound-and-staticWhat is the difference between the following class methods?Is it that one is static转载 2015-05-04 09:39:10 · 709 阅读 · 0 评论 -
Python属性和方法
转载出处:http://abyssly.com/2013/08/19/python_attributes_and_methods/关于此文解释了Python新式对象的属性访问机制:函数是如何成为方法的?descriptor和property是如何工作的?如何确定方法解析顺序(method resolution order)?新式对象是从Python2转载 2015-05-04 09:30:58 · 4546 阅读 · 0 评论 -
Using YUM to install specific MySQL/Percona Server versions
原文地址:http://www.percona.com/blog/2015/01/05/using-yum-to-install-specific-mysqlpercona-server-versions/Sometimes it is desired to use particular software versions in production, and not nece转载 2015-04-24 09:07:35 · 775 阅读 · 0 评论 -
Golang channels tutorial
原文链接:http://guzalexander.com/2013/12/06/golang-channels-tutorial.htmlgolang channels 入门足矣Golang has built-in instruments for writing concurrent programs. Placing a go statement before a functi转载 2015-04-25 17:21:05 · 983 阅读 · 0 评论 -
Linux Kernel: What is the major difference between the buffer cache and the page cache?
The page cache caches pages of files to optimize file I/O. The buffer cache caches disk blocks to optimize block I/O.Prior to Linux kernel version 2.4, the two caches were distinct: Files were in转载 2015-06-02 15:40:13 · 784 阅读 · 0 评论 -
Prototype pattern (Python recipe)
原文链接:http://code.activestate.com/recipes/86651-prototype-pattern/http://dongweiming.github.io/python-pototype.htmlfrom copy import deepcopyclass Prototype: def __init__(self): self转载 2015-07-08 14:50:33 · 857 阅读 · 0 评论 -
coverage.py的覆盖率统计原理
原文出处:http://blog.theerrorlog.com/how-coverage-py-produce-coverage-statistics.html在Erlang下,用rebar可以在运行单元测试的同时调用cover模块,从而得 到单元测试的覆盖率,这是很方便的一个功能。最近发现Python下的nose也可 以通过--with-coverage选项达到类似的效果,转载 2015-07-08 10:18:23 · 6330 阅读 · 1 评论 -
TCP数据包分片机制详解
原文地址:http://www.cnitblog.com/donne/archive/2010/12/23/72500.aspxIP分片 在以太网上,由于电气限制,一帧不能超过1518字节,除去以太网帧头14字节(mac地址等)和帧尾4字节校验,还剩1500字节,这个大小称为MTU(最大传输单元)。 如果你的IP包大于1500字节,IP层就会分片了。 而1492的MTU值的来源,是因为PP转载 2015-09-24 17:16:01 · 18481 阅读 · 2 评论 -
tcp拥塞控制时间轴上三种状态的关系,慢启动,拥塞避免,以及快速恢复的教学状态图。
原文出处:http://blog.csdn.net/brother_lei/article/details/8117484发现Computer Networking: A Top-Down Approach中关于拥塞控制的状态图非常好,写篇博客,方便自己以后复习。名词解释:slow start: 慢启动。congestion avoidance: 拥塞避免。转载 2015-10-09 20:30:55 · 3190 阅读 · 0 评论 -
How MongoDB’s Journaling Works
This was originally posted to Kristina Chodorow’s blog, Snail in a TurtleneckI was working on a section on the gooey innards of journaling for The Definitive Guide, but then I realized it’s an imple转载 2015-09-08 17:23:23 · 625 阅读 · 0 评论 -
Abstract Classes and Factory Design Pattern in Python
Abstract Classes are one of the most useful and important concepts in Object Oriented Programming. I’ll attempt to illustrate their usefulness, and their usage in Python 2.7 with the following (seem转载 2015-07-14 11:15:23 · 723 阅读 · 0 评论 -
Multiprocessing vs Threading Python
Q:I am trying to understand the advantages of multiprocessing over threading. I know thatmultiprocessing gets around the Global Interpreter Lock, but what other advantages are there, and can threa转载 2015-07-13 14:58:15 · 1060 阅读 · 0 评论 -
Python multiprocessing.Pool: when to use apply, apply_async or map?
来自stackoverflowQ:I have not seen clear examples with use-cases for Pool.apply, Pool.apply_async and Pool.map. I am mainly using Pool.map; what are the advantages of others?A:Back转载 2015-07-13 13:53:15 · 7425 阅读 · 0 评论 -
strategy pattern in Python
1.function based#!/usr/bin/env pythonimport typesdef method_property(name): def getter(self): return getattr(self, name) def setter(self, value): setattr(self, name, type转载 2015-07-13 11:14:47 · 679 阅读 · 0 评论 -
Python thread pool similar to the multiprocessing Pool?
Q:Is there a Pool class for worker threads, similar to the multiprocessing module's Pool class?I like for example the easy way to parallelize a map functiondef long_running_func(p):转载 2015-07-13 14:39:52 · 1215 阅读 · 0 评论 -
Dead simple example of using Multiprocessing Queue, Pool and Locking
Q:I tried to read the documentation at http://docs.python.org/dev/library/multiprocessing.html but I'm still struggling with multiprocessing Queue, Pool and Locking. And for now I was able to转载 2015-07-13 14:17:42 · 509 阅读 · 0 评论 -
Python的Descriptor在Django中的使用
这篇通过Django源码中的cached_property来看下Python中一个很重要的概念——Descriptor(描述器)的使用。想必通过实际代码来看能让人对其用法更有体会。什么是Descriptor?Descriptor是Python中定义的一个协议,协议的内容是只要你定义的这个类(对象)具有: __get__, __set__, __delete__ 方法中的任意一个转载 2015-04-15 21:09:19 · 1488 阅读 · 0 评论 -
How to Get a List of Class Attributes in Python
The other day, I was trying to figure out if there was an easy way to grab a class’s defined attributes (AKA “instance variables”). The reason was that we were using the attributes we created to match转载 2015-04-06 17:36:59 · 836 阅读 · 0 评论 -
#devopstools 用DD测试磁盘读写速度
原文出处:http://blog.csdn.net/xrb66/article/details/7180919问: 以下几种方式测试磁盘读写速度有什么区别?1234dd bs=1M count=128 if=/dev/zero of=test dd bs=1M count=128 if=/dev/zero of=tes转载 2015-01-28 15:37:04 · 625 阅读 · 0 评论 -
#devopstools linux io 测试工具 iozone
个人补充说明: rpm 安装地址 http://apt.sw.be/redhat/以下为转载,转载出处:http://blog.sina.com.cn/s/blog_667725170100ttet.html介绍iozone(www.iozone.org)是一个文件系统的benchmark工具,可以测试不同的操作系统中文件系统的读写性能。可以测试 Read, write转载 2015-01-28 15:07:22 · 882 阅读 · 0 评论 -
如何指定进程运行的CPU(命令行 taskset)
coolshell最新的文章《性能调优攻略》在“多核CPU调优”章节,提到“我们不能任由操作系统负载均衡,因为我们自己更了解自己的程序,所以,我们可以手动地为其分配CPU核,而不会过多地占用CPU0,或是让我们关键进程和一堆别的进程挤在一起。”。在文章中提到了Linux下的一个工具,taskset,可以设定单个进程运行的CPU。同时,因为最近在看redis的相关资料,redis作为单进程模转载 2015-01-27 20:55:07 · 26373 阅读 · 0 评论 -
zabbix table -- History and Trends
These two terms can cause some confusion, but their understanding is crucial for small and medium environments.HistoryAll collected data, doesn’t matter what type, will be stored on history ta转载 2015-01-27 10:47:28 · 2422 阅读 · 0 评论 -
pidstat - 监控并统计Linux进程的数据
转载声明:via: http://linoxide.com/linux-command/linux-pidstat-monitor-statistics-procesess/作者:Adrian Dinu 译者:John 校对:wxy本文由 LCTT 原创翻译,Linux中国 荣誉推出原文: http://linoxide.com/linux-comman转载 2014-11-20 14:32:20 · 1858 阅读 · 0 评论 -
关于python中的setup.py
本文是转载的,源地址:http://lingxiankong.github.io/blog/2013/12/23/python-setup/感谢作者,解决了我一个大问题转载 2014-11-14 10:41:27 · 79860 阅读 · 5 评论 -
发布python的包至pypi服务器
原文出处:http://yejinxin.github.io/distribute-python-packages-to-pypi-server/感谢原作者使用pip或easy_install可以管理和安装python的package包,实际上它们都是从pypi服务器中搜索和下载package的。目前在pypi服务器上,有超过三万多个package,同时还允许我们将自己的代码也上传转载 2014-11-14 10:53:05 · 3675 阅读 · 2 评论 -
RESTful Request:GET/PUT/DELETE/POST/HEAD/OPTIONS
个人感觉写的不错,无耻的转载了,原文链接:转载 2014-10-28 13:12:14 · 7086 阅读 · 0 评论 -
Understanding Disk I/O
这篇文章是我翻译的第一篇文章有些地方翻译的不是很好见谅:-),文章来自scout的官方博客(点我),个人第一次读的时候感觉很赞。文章主要讲了什么呢?磁盘IO是什么?怎么样才能判断你遇到了磁盘I/O的瓶颈?如何解决磁盘IO的瓶颈本文还推荐了scout的一些监控插件关于scout的介绍Scout是一个服务器和应用扩展监控服务,它主要关注于安装和配置的易用性。Scout默认提供了报警功翻译 2014-09-27 18:42:54 · 1026 阅读 · 0 评论 -
I/O Benchmarking tools
This blog post will be a place to park ideas and experiences with I/O benchmark tools and will be updated on an ongoing basis.Please feel free to share your own experiences with these tools or o转载 2015-01-28 18:59:43 · 806 阅读 · 0 评论 -
tcmalloc vs. jemalloc
from stackoverflow:Q:I have an application which allocates lots of memory and I am considering using a better memory allocation mechanism than malloc.My main options are: jemalloc and tcma转载 2015-01-14 21:06:15 · 5113 阅读 · 0 评论 -
Moosefs基本概念总结
原链接:http://os.51cto.com/art/201209/355996.htm最近了解了一个分布式文件系统——MooseFS,之前对分布式的东西知道的很少,分布式文件系统、分布式数据库都是近而远之,觉得太复杂了离我还很遥远。在各位老师的推动下我用6台机器实践了一下moosefs,moosefs的部署还是很简单的,和配置NFS很像,就是多了两种角色的机器,正是有了它们,才使得转载 2015-01-19 10:18:16 · 1050 阅读 · 0 评论 -
how to install git 1.8 rpm
It appears that git18 is no longer available from RPMForge, at least in CentOS 6.6. Luckily, I came across the following instructions from a GitLab CentOS recipe:Download PUIAS repo:wget转载 2015-04-20 13:44:19 · 5993 阅读 · 1 评论 -
理解lua 语言中的点、冒号与self
转载自:http://my.oschina.net/lonewolf/blog/173065&&转载自:http://www.faceye.net/search/80097.html在lua开发中我们经常会混淆这两者之间的区别,下面通过一个示例来解释:Class = {}Class.__index = Class function Class.new(x,y)转载 2015-03-12 14:38:03 · 4149 阅读 · 0 评论 -
MongoDB 副本集自动复制 Replica Set
转载出处:http://blog.fens.me/mongodb-replica-set/ MongoDB 副本集自动复制 Replica Set,分为7个部分初始化文件目录启动副本集 Replica Set模拟 PRIMARY失败,SECONDARY自动切换修复失败节点恢复失败节点,补充到SECONDARY删除一个Replica Set节点新增加一转载 2015-03-06 10:29:01 · 1051 阅读 · 0 评论 -
结合docker 快速的构建 Cassandra开发环境
尝试一门新的技术的时候。可以考虑使用docker 解决环境的依赖,简单方便快捷。原文出处:http://blog.abhinav.ca/blog/2014/09/15/cassandra-cluster-docker-one-command/补充一点,下面需要的cql等命令需要自己手动的安装下载地址:http://mirrors.cnnic.cn/apache/cassandra/2.1.转载 2015-03-04 16:23:39 · 3901 阅读 · 0 评论