Mac OS X重命名磁盘卷标

加了块ssd硬盘,默认的分区名是 “未命名1”, 有点二,改了个好理解的。

$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk1s2 on /Volumes/Macintosh HD (hfs, local, journaled)
$sudo diskutil rename /dev/disk0s2 "SSD盘"

[转载]我眼中的各Linux发行版用户

我眼中的各Linux发行版用户

backup:关于coroutine(协程)和事件驱动的一些文章

node.js为什么不用coroutine?
node.js和coroutine
风格之争:Coroutine vs Callback
Call/CC与Node.js

最早听说协程的概念来源于Lua,后来逛论坛听说了stackless python,再后来听说erlang也是用这种方法,但是一直没怎么细看。正好要准备个年后的python的分享,中间涉及到pypy和stackless python,又得扯到协作式多线程(微线程,协程)的概念,便又了解了一番。

backup:IRC相关链接

wiki:http://www.irc-wiki.org/
最流行的server:http://www.unrealircd.com/
最流行的webirc:qwebirc.org (python+twisted)
最流行的ircbot:https://github.com/ProgVal/Limnoria(python+twisted)

backup:更实用的大文件搜索

findbigfile.py

#!/usr/bin/env python
import sys, os

#100M
BIG_FILE_SIZE = 1024 * 1024 * 100
BIG_DIR_SIZE = int(os.popen('getconf PAGE_SIZE').read().strip()) * 1024
EXCLUDES = ['/home/cdn/wpt_data']

EXCLUDES = [os.path.normpath(p) for p in EXCLUDES]
stack = [os.path.normpath(sys.argv[1])] 

def format_size(s):
    if s < 1024:
        return '%d Bytes' % s
    if s < 1024 * 1024:
        return '%d KB' % (s/1024)
    if s < 1024 * 1024 * 1024:
    	return '%d MB' % (s/1024/1024)
    return '%d GB' % (s/1024/1024/1024)

while len(stack):
    check_file = stack.pop()

    if check_file in EXCLUDES:
        continue

    #pass link
    if os.path.islink(check_file):
        continue

    if os.path.isfile(check_file):
        s = os.path.getsize(check_file)
        if s > BIG_FILE_SIZE:
            print 'BIG FILE:%s\t%s' % (check_file, format_size(s))
        continue

    if os.path.isdir(check_file):
        s = os.path.getsize(check_file)

        #pass big directory
        if s > BIG_DIR_SIZE:
            print 'BIG DIR:%s\t%s' % (check_file, format_size(s))
            continue

        try:
            for f in os.listdir(check_file):
                stack.append(os.path.join(check_file, f))
        except:
            pass