View multiprocessing_download.py
# coding: utf-8 | |
import requests | |
from multiprocessing import Process, Pipe | |
def downloader(url, chunk_size, conn): | |
downloaded_parts = 0 | |
with open('download', 'wb') as fp: |
View download_stream.py
# coding: utf-8 | |
import requests | |
chunk_size = 1024 * 1024 # 1mb | |
download_url = 'http://speedtest.ftp.otenet.gr/files/test10Mb.db' | |
downloaded_parts = 0 | |
with open('download', 'wb') as fp: | |
response = requests.get(download_url, stream=True) |
View main.py
from pprint import pprint | |
from datetime import datetime | |
from project_files import * | |
from git_hub_scrapper import * | |
from file import * | |
DOMAIN = 'https://github.com' | |
def main(): | |
print('[INICIO.{_date:%Y/%m/%d %H:%M:%S}]'.format(_date=datetime.now())) |
View depth.py
def get_depth(self): | |
parent = self.parent | |
depth = 0 | |
while parent is not None: | |
parent = parent.parent | |
depth += 1 | |
return depth | |
# coloca isso na classe Link |
View github_scrapper.py
# coding: utf-8 | |
""" | |
pip install requests beautifulsoup4 | |
""" | |
import requests | |
from bs4 import BeautifulSoup |
View pre-commit
#!/usr/bin/env python | |
# Original at http://tech.yipit.com/2011/11/16/183772396/ | |
# Insert this into .git/hooks/pre-commit | |
import re | |
import subprocess | |
import sys | |
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)') |
View django_test_manage.py
#!/usr/bin/env python | |
import os | |
import sys | |
from django.core.management import ManagementUtility | |
from django_test_runner import is_nosetest | |
from pycharm_run_utils import import_system_module | |
from teamcity import teamcity_presence_env_var |
View compress_s3_images.py
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import sys | |
from boto.s3.connection import S3Connection | |
from cStringIO import StringIO | |
from PIL import Image as pil | |
AWS_KEY = '[AWS KEY HERE]' |
View mocking_condition.py
# coding: utf-8 | |
import functools | |
def _mock_condition(condition, *args, **kwargs): | |
return condition(*args, **kwargs) | |
def mock_condition(condition): |
View name_mangling.py
# coding: utf-8 | |
class Image(object): | |
def __format(self): | |
return 'PNG' | |
image = Image() |
NewerOlder