git branch --merged master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!-*- coding:utf-8 -*- | |
import re | |
from pdfminer.pdfparser import PDFParser | |
from pdfminer.pdfdocument import PDFDocument | |
from pdfminer.pdftypes import resolve1 | |
from pdfrw import PdfReader | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
def sort_by_frequency_with_original_order_fake(_list): | |
""" | |
1. Sortd by frequency at first; | |
2. When some items have the same frequency, follow the original order. (failed!!!) | |
""" | |
counter = collections.Counter(_list) | |
_counter = sorted(counter.items(), key=lambda t: t[1], reverse=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import defaultdict | |
def defaultdict2dict(d): | |
_d = {} | |
for k, v in d.items(): | |
if isinstance(v, defaultdict): | |
_d[k] = defaultdict2dict(v) | |
else: | |
_d[k] = v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
I = 'I' | |
V = 'V' | |
X = 'X' | |
L = 'L' | |
C = 'C' | |
M = 'M' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
import slugify | |
from selenium import webdriver | |
DIR = os.path.dirname(os.path.abspath(__file__)) | |
def capture_with_proxy(url, proxy_url, username, password): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlsoup | |
from sqlalchemy import create_engine | |
from sqlalchemy.orm import scoped_session, sessionmaker | |
def singleton(cls, *args, **kwargs): | |
instances = {} | |
def get_instance(): | |
if cls not in instances: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from db import db | |
""" | |
The Douban Group API which not display on http://developers.douban.com/wiki/?title=api_v2 | |
Base url: https://api.douban.com/v2 | |
Group info: /group/:id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a[ei, ә]art.一个 | |
an[әn, æn]art.一个 | |
ability[ә'biliti]n.能力,才干 | |
able['eibl]a.有才能的,能够的 | |
about[ә'baut]prep.关于 | |
above[ә'bʌv]prep.在…之上 | |
accident['æksidәnt]n.意外;偶然事故 | |
according to[әˌkɔ:diˌ tu:]依照 | |
achieve[ә'tʃi:v]vt.完成 | |
across[ә'krɔs]ad.交叉;横过 |