Skip to content

Instantly share code, notes, and snippets.

Avatar

iury IuryAlves

View GitHub Profile
@IuryAlves
IuryAlves / ftpServer.py
Last active Jul 28, 2019
Uso básico de um servidor FTP implementado em python com a biblioteca pyftpdlib https://code.google.com/p/pyftpdlib/
View ftpServer.py
#encoding: utf-8
from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
import sys
# importante: a biblioteca pyftpdlib não é padrão do python, precisa ser instalada
# link: https://code.google.com/p/pyftpdlib/downloads/list
@IuryAlves
IuryAlves / ftpClient.py
Last active Dec 11, 2018
Cliente FTP implementado em python
View ftpClient.py
# coding: utf-8
from ftplib import FTP
import log
import logging
#log.criarLog()
log.atualizarLog()
# A função abaixa um arquivo definido por 'filename' na pasta definida por local com o nome
# especificado por 'name'
def download(handler, name, filename="musica1.mp3"):
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 Teste.java
import java.util.List;
public class Teste {
public static void main(String[] args) {
Estoque e = new Estoque();
//cadastrando carros
@IuryAlves
IuryAlves / pre-commit
Created Aug 31, 2017
git pre-commit hook
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>.*)')
@IuryAlves
IuryAlves / django_test_manage.py
Created Jul 25, 2017
Run Django tests without migrations
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
You can’t perform that action at this time.