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 re | |
texto = 'aqui vai a string com os meus@emails.com.br" | |
emails = re.findall(r'[\w\.-]+@[\w\.-]+', texto) |
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
pip3 install virtualenvwrapper | |
# Checar onde entá instalado e qual esta sendo usado | |
which python3 | |
which virtualenvwrapper.sh | |
#Virtual Env Python | |
export WORKON_HOME=$HOME/.virtualenvs # Diretorio dos envs | |
export PROJECT_HOME=$HOME/pyprojects # diretorio dos projetos | |
export PIP_VIRTUALENV_BASE=$WORKON_HOME |
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
def subset_sum(numbers, target, partial=[]): | |
s = sum(partial) | |
# check if the partial sum is equals to target | |
if s == target: | |
print "sum(%s)=%s" % (partial, target) | |
if s >= target: | |
return # if we reach the number why bother to continue | |
for i in range(len(numbers)): |
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 os | |
import re | |
import subprocess | |
import time | |
import requests | |
#Usa um Webhook do IFTTT | |
URL = 'https://maker.ifttt.com/trigger/{NOME DO TRIGGER}/with/key/{CHAVE}' | |
#speedtest-cli => pip install speedtest-cli |
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
emails = [] | |
arquivos = ['limpo-1.txt','limpo-2.txt','limpo-3.txt','limpo-4.txt','limpo-5.txt'] | |
for arquivo in arquivos: | |
with open(arquivo,'r') as arqLista: | |
for linha in arqLista: | |
emails.append(linha) |
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
## Limpa linhas em branco dos arquivos | |
with open('5.txt') as infile, open('limpo-5.txt', 'w') as outfile: | |
for line in infile: | |
if not line.strip(): continue # pula linha em branco | |
outfile.write(line) # escreve linha no novo arquivo |
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
# Recursively check for images in a directory and compare with referenced images in CSS and HTML files | |
# in tha folder, generating two CSV files: | |
# One with used images and one with not referenced ones | |
# (does not look into JS files) | |
import glob | |
import csv | |
# Create the list of file names | |
pasta = "src/" #root of the project source files |
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
#pede numero de rows e leading desejado | |
rows = int(input("Quantas rows: ")) | |
leading = float(input("Leading em pontos: ")) | |
alturaPapel = float(input('Altura do papel em pol: ')) | |
#Calcula tamanho do papel em pontos | |
def convAltura(h): | |
return h*72 | |
#Calcula tamanho total do frame baseado em linhas de texto por row |
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
#Abrir o arquivo | |
f = open('pt-BR-utf8', 'r') | |
#ler uma linha | |
for line in f: | |
palavra = line.replace("\n", "") | |
palavra = palavra.lower() | |
#inverter a palavra | |
palavra_reversa = palavra[::-1] |
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 | |
# | |
# Extracts email addresses from one or more plain text files. | |
# | |
# Notes: | |
# - Does not save to file (pipe the output to a file if you want it saved). | |
# - Does not check for duplicates (which can easily be done in the terminal). | |
# | |
# (c) 2013 Dennis Ideler <ideler.dennis@gmail.com> |
NewerOlder