LeetCode-Two Sum

class Solution:
    # @return a tuple, (index1, index2)
    def twoSum(self,num, target):
        dict1={}
        for index,numbers in enumerate(num,1):
            minu=target-numbers
            if numbers in dict1:
                return dict1[numbers],index
            else:
                dict1[minu]=index

View comments.

more ...


在Windows下安装Fabric

When installing pycrypto you will get several errors. The best way to solve it is NOT install it on Windows. XD

So you need to manually download pycrypto. And before you run setup.py you should edit setup.py and replace all -std=c99 with -std=gnu99

Then just run ...

View comments.

more ...

Munin安装及配置

Munin是一个强大的服务器性能状态监控软件

  1. Debian或者Ubuntu系统:

    apt-get install munin munin-node

  2. 编辑/etc/munin/munin.conf 取消下面几行注释

    dbdir /var/lib/munin
    htmldir /var/cache/munin/www
    logdir /var/log/munin
    rundir  /var/run/munin
    tmpldir /etc/munin/templates
    
  3. 加入检测节点(用小写以免出现各种奇葩错误)

    [monitor]
    address 127.0.0.1
    use_node_name yes
    
  4. 配置Nginx

    server {
        root /var/cache/munin/www ...

View comments.

more ...