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
#!/usr/bin/env python | |
import os | |
import sys | |
class Progress: | |
def __init__(self, fillchar='#', width=80): | |
self.fillchar = fillchar | |
self.width = width |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset=utf-8> | |
<title>WebSocket test</title> | |
</head> | |
<body> | |
<script> | |
if (window.MozWebSocket) { | |
window.WebSocket = window.MozWebSocket; |
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
@-moz-document domain('weibo.com') { | |
a[title=赞],a[title=让红包飞],i[title=微博达人],a[title=微博会员]{ | |
display:none !important; | |
} | |
.WB_handle i:nth-child(2){ | |
display:none !important; | |
} | |
span.hover { | |
display:none !important; | |
} |
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 urllib, urllib2 | |
import random | |
import re | |
from xml.dom import minidom | |
# Levenshtein Distance | |
def lev(first, second): | |
"""Find the Levenshtein distance between two strings.""" | |
if len(first) > len(second): |
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 requests | |
import sys, os, re | |
from gevent import monkey, pool, Timeout | |
monkey.patch_all(dns=False) | |
p = pool.Pool(20) | |
TIMEOUT = 10 | |
title_p = re.compile(r'title>([^\]]*)</title') | |
base_p = re.compile(r"pic_base\s=\s'([^']*)'") |
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 bottle | |
import requests | |
import PyRSS2Gen as gen | |
from datetime import timedelta, datetime | |
from multiprocessing.dummy import Pool | |
import urllib | |
import json |
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 | |
from __future__ import division | |
import itertools | |
exp_list = ['((%d{}%d){}%d){}%d', '(%d{}%d){}(%d{}%d)', | |
'(%d{}(%d{}%d)){}%d', '%d{}((%d{}%d){}%d)', | |
'%d{}(%d{}(%d{}%d))'] | |
op_list = list(itertools.product('+ - * /'.split(), repeat=3)) |
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
{"\u8000": "5069", "\u6d89": "3195", "\u8c08": "6151", "\u4f0a": "0122", "\u4e9f": "0069", "\u6d1e": "3159", "\u7322": "3724", "\u60ab": "1952", "\uff2a": "9883", "\u6cb3": "3109", "\u4e34": "5259", "\u72b7": "3755", "\u5438": "0705", "\u5a3c": "1233", "\u7ebf": "4848", "\u53cd": "0646", "\u724c": "3654", "\u96cf": "7176", "\u59d1": "1196", "\u7850": "8943", "\u9cd3": "5016", "\u5362": "4151", "\u77e5": "4249", "\u9664": "7110", "\u5f6a": "1753", "\u95f9": "7593", "\u5eff": "9824", "\u8986": "6010", "\u8f8a": "6547", "\u5e94": "2019", "\u881b": "5864", "\u8e1f": "6442", "\u5121": "8079", "\u76a4": "4115", "\u5d29": "1514", "\u82ac": "5358", "\u51b6": "0396", "\u9abc": "7547", "\u8d49": "6336", "\u6e5f": "3207", "\u8dde": "6491", "\u56e4": "0937", "\u5ce8": "1494", "\u62ec": "2161", "\u68f0": "2774", "\u8c73": "6279", "\u6ef4": "3336", "\u987b": "7312", "\u5b7d": "5642", "\u9e7f": "7773", "\u7f2a": "4924", "\u6c89": "3089", "\u4e0a": "0006", "\u728d": "3682", "\u540e": "0683", "\u7891": "4301", "\u9910": "7404 |
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 math import ceil | |
from itertools import izip_longest | |
def encrypt(s, w): | |
n = len(s) | |
l = [s[i:i + w] for i in xrange(0, n, w)] | |
es = [''.join(t) for t in izip_longest(*l, fillvalue='')] | |
return str(w) + ''.join(es) |
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 | |
from path import path | |
import eyeD3 | |
eyeD3.LOCAL_ENCODING = 'utf-8' | |
b = path('.') | |
artist = b.abspath().basename() | |
for f in b.walkfiles(): | |
if f.ext != '.mp3': |