This file contains hidden or 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
| r = requests.get(file_url) | |
| size = int(r.headers['Content-Length'].strip()) | |
| self.bytes = 0 | |
| widgets = [name, ": ", Bar(marker="|", left="[", right=" "), | |
| Percentage(), " ", FileTransferSpeed(), "] ", | |
| self, | |
| " of {0}MB".format(str(round(size / 1024 / 1024, 2))[:4])] | |
| pbar = ProgressBar(widgets=widgets, maxval=size).start() | |
| file = [] | |
| for buf in r.iter_content(1024): |
This file contains hidden or 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 io import BytesIO | |
| import progressbar | |
| class CancelledError(Exception): | |
| def __init__(self, msg): | |
| self.msg = msg | |
| Exception.__init__(self, msg) | |
| def __str__(self): |
This file contains hidden or 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
| # colafile downloader | |
| import re | |
| import sys | |
| import requests | |
| s = requests.session() | |
| ids = [] | |
| if len(sys.argv) < 2: | |
| # print usage |
This file contains hidden or 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/python | |
| #coding=utf-8 | |
| import urllib2 | |
| import sys | |
| import re | |
| import bs4 | |
| import os | |
| import time |
This file contains hidden or 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/python | |
| #coding=utf-8 | |
| import urllib2 | |
| import sys,os | |
| from bs4 import BeautifulSoup | |
| import re | |
| import time | |
| def etymology(key): | |
| page = urllib2.urlopen("http://www.etymonline.com/index.php?term=" + key).read().decode("utf-8") |
This file contains hidden or 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/python | |
| #coding=utf-8 | |
| import urllib2 | |
| import re | |
| import sys | |
| from bs4 import BeautifulSoup | |
| def get_context(key): | |
| ret = urllib2.urlopen('http://www.merriam-webster.com/dictionary/%s' % key).read().decode("utf-8") |
This file contains hidden or 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 pyPdf import PdfFileWriter, PdfFileReader | |
| import sys | |
| def generate_page_list(n): | |
| print n,'pages' | |
| foo = [] | |
| flag1 = n % 2 | |
| # if n is an odd number, page n+1 is a BlankPage | |
| if flag1 == 1: | |
| n += 1 | |
This file contains hidden or 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 json | |
| import sys | |
| import re | |
| from baidupcsapi import PCS | |
| import progressbar | |
| CWD = os.getcwd() | |
| DIR_INFO = {} |
This file contains hidden or 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 json | |
| from baidupcsapi import PCS | |
| pcs = PCS('username','password') | |
| def walk(path, tabs=0): | |
| print '\t'*tabs+path | |
| files = json.loads(pcs.list_files(path).content)['list'] | |
| for file in files: | |
| if file['isdir'] == 1: |
This file contains hidden or 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 json | |
| from baidupcsapi import PCS | |
| pcs = PCS('u','p') | |
| folders = set() | |
| def get_folder(path): | |
| print '* found',path | |
| files = json.loads(pcs.list_files(path).content)['list'] |
OlderNewer