layout: post title: "读《打造 Facebook》" date: 2013-02-25 00:51 comments: true categories: 学海无涯 tags:
- 创业
- 读书笔记
| gsettings set org.gnome.shell.overrides workspaces-only-on-primary false |
| --- | |
| layout: nil | |
| --- | |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"> | |
| <channel> | |
| <description><![CDATA[{{ site.title }}]]></description> | |
| <title><![CDATA[{{ site.title }}]]></title> | |
| <link>{{ site.url }}/</link> | |
| <pubDate>{{ site.time | date_to_xmlschema }}</pubDate> |
| #!/usr/bin/env python2 | |
| # coding=utf-8 | |
| # convert MoinMoin wiki to text | |
| # for moinmoin 1.9.x | |
| # author: alswl | |
| # update at: 2012-07-22 | |
| import sys | |
| import os |
layout: post title: "读《打造 Facebook》" date: 2013-02-25 00:51 comments: true categories: 学海无涯 tags:
| # coding=utf-8 | |
| """Worker Scripts""" | |
| import os | |
| import sys | |
| _root = os.path.dirname(os.path.abspath(__file__)) | |
| import cPickle as pickle | |
| import logging | |
| from tornado.options import options |
| # 15. 等级丰度曲线 | |
| # 根据 name 返回 color, lty | |
| get_line_type = function(name) { | |
| if (length(grep('-1$', name)) > 0) { | |
| color <- 1 | |
| } else if (length(grep('-2$', name)) > 0) { | |
| color <- 2 | |
| } else if (length(grep('-3$', name)) > 0) { |
| # coding=utf-8 | |
| import csv | |
| import codecs | |
| import cStringIO | |
| import sys | |
| class UTF8Recoder: | |
| """ |
| # coding=utf-8 | |
| import csv, codecs, cStringIO | |
| class UTF8Recoder: | |
| """ | |
| Iterator that reads an encoded stream and reencodes the input to UTF-8 | |
| """ | |
| def __init__(self, f, encoding): | |
| self.reader = codecs.getreader(encoding)(f) |
| # -*- coding: UTF-8 -*- | |
| import sys | |
| import struct | |
| import codecs | |
| PinYinDic = [ | |
| "a", | |
| "ai", | |
| "an", | |
| "ang", |
| # coding=utf-8 | |
| from __future__ import print_function, unicode_literals | |
| import re | |
| def convert_named_group_to_position_based_group(regex, replacement): | |
| position_based_regex = regex | |
| position_based_replacement = replacement | |
| named_groups = [x[3:-1] for x in re.findall(r'(\?P<[a-z_]+>)', regex)] |