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
# sudo pacman -S inotify-tools | |
# chmod +x reload.sh | |
FILE=diagram.py | |
while inotifywait -e close_write $FILE; do python $FILE; done |
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 watchdog.observers import Observer | |
from watchdog.events import FileSystemEventHandler | |
import sys | |
import os | |
import time | |
import subprocess as subp | |
FILENAME = sys.argv[1] | |
PROC = None |
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 requests | |
import csv | |
import json | |
from datetime import datetime | |
import locale | |
locale.setlocale(locale.LC_ALL, 'pt_BR.UTF-8') | |
def extract_cpf_mesano(row): | |
cpf = row['CPF'].strip() |
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
"""Cause the fstrings notation into the example 'congrats' functions, | |
the examples only works in python 3.8. | |
""" | |
from functools import partial | |
class Pipe: | |
def __init__(self, function): | |
self.function = function | |
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 pandas as pd | |
from math import sqrt | |
GRAV_CONST = 9.8 # m/s^2 | |
def calc_velocity(STRIDE_LENGTH, LEG_LENGTH, grav_const): | |
return ((STRIDE_LENGTH / LEG_LENGTH) - 1) * sqrt(LEG_LENGTH * grav_const) | |
dataset1 = pd.read_csv('dataset1.csv') |
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 flask import Flask, request, send_from_directory, send_file | |
from PIL import Image, ImageFilter | |
from io import BytesIO | |
import os | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return '<h1>Olá mundo</h1>' |
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/python3 | |
from PIL import Image | |
ASCII_CHARS = [ '#', '?', '%', '.', 'S', '+', '.', '*', ':', ',', '@'] | |
def scale_image(image, new_width=100): | |
"""Resizes an image preserving the aspect ratio. | |
""" | |
(original_width, original_height) = image.size |
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 | |
code = 'se 1234 > 4321: mostre "verdadeiro"' | |
def mostre(code): | |
code = code.replace(' ', '') | |
r_print = re.compile('^mostre"[a-z A-Z]*"$') | |
rprint = r_print.match(code) |
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 shutil | |
class Constantes: | |
def __init__(self, name): | |
self.name = name | |
def __add__(self, other): | |
aux = self.name + '+' + str(other) |
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 | |
def cdDir(path, cont): | |
diretorio = os.path.dirname(os.path.abspath(path)) | |
if cont <= 0: | |
return diretorio | |
cont = cont - 1 | |
return cdDir(diretorio, cont) |
NewerOlder