Skip to content

Instantly share code, notes, and snippets.

View Ronald-TR's full-sized avatar
:shipit:
Stealth

Ronald Ronald-TR

:shipit:
Stealth
View GitHub Profile
@Ronald-TR
Ronald-TR / uvgen.py
Last active September 22, 2017 02:46
urls_viewsGenerator
from django.__main__ import management
from importlib import *
import os
urlpatterns = """from django.conf.urls import url
from django.contrib import admin
from {pathapp}._views import *
class LzwAlgorithm:
def __init__(self, texto = ''):
self.dicionario_encode = {chr(i): i for i in range(256)}
self.dicionario_decode = {i: chr(i) for i in range(256)}
self.data_encoded = []
self.data_decoded = []
self.texto = texto
self.encode()
self.decode()
@Ronald-TR
Ronald-TR / cd.py
Created March 16, 2018 04:19
CD in Python
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)
import os
import shutil
class Constantes:
def __init__(self, name):
self.name = name
def __add__(self, other):
aux = self.name + '+' + str(other)
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)
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>'
import pytesseract as ocr
import numpy as np
import cv2
from PIL import Image
# tipando a leitura para os canais de ordem RGB
imagem = Image.open('saoluis.jpg').convert('RGB')
# convertendo em um array editável de numpy[x, y, CANALS]
@Ronald-TR
Ronald-TR / dinos.py
Created October 5, 2019 19:59
dinos
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')
@Ronald-TR
Ronald-TR / pipe_in_python.py
Last active November 20, 2019 12:06
Simple implementation of pipe operator into your functions: https://code.sololearn.com/ca4QB7ZEM91L/#py
"""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
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()