Skip to content

Instantly share code, notes, and snippets.

View CoutinhoElias's full-sized avatar

Elias Coutinho CoutinhoElias

View GitHub Profile
@CoutinhoElias
CoutinhoElias / trello.py
Last active August 31, 2024 19:52
Trello app applied to my needs.
# Json init unique_deal_stage_names.json
{"Testados": "colors.LIGHT_GREEN", "Realizados": "colors.DEEP_ORANGE_400", "Liberados": "colors.LIGHT_GREEN", "Concluidos": "colors.RED"}
# My Modified Trello. (dd_personalizado.py)
import logging
import flet
from flet import (
Page,
DragTarget,
Draggable,
@CoutinhoElias
CoutinhoElias / create_pedido.py
Created May 16, 2023 17:49
Add register from Excel in SQL Server
import pandas as pd
from pandas import to_datetime
from datetime import datetime
import pytz
from sqlalchemy import create_engine, text, Column, update, insert, select, and_, distinct, func
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm import Session
''' USO PEEWEE PARA GERAR MEUS DADOS DIRETAMENTE DO POSTGRES'''
''' MEUS MODELOS PODEM SER ABSTRAIDOS DO EXEMPLO '''
from ntpath import join
from peewee import fn, JOIN
from models import Detalhe, Produto, Grupo, Familia, Unidade, Pessoas, Estoque, Codigos, Docitem, Comitem
import pandas as pd
from datetime import datetime
''' ABAIXO CRIO MINHA CONSULTA PARA USAR NOS GRÁFICOS '''
@CoutinhoElias
CoutinhoElias / pandas_df.py
Last active August 27, 2022 19:46
meu problema
from dash import Dash
from dash_html_components import Div, H1, P, H3
from dash_core_components import Graph, Dropdown, Slider, Checklist
from dash.dependencies import Input, Output
from random import randint
import pandas as pd
app = Dash(__name__)
@CoutinhoElias
CoutinhoElias / sub_query.py
Last active September 18, 2023 09:12
Subquery on peewee
# When referencing a table multiple times, we'll call Model.alias() to create
# a secondary reference to the table.
EstoqueAlias = Estoque.alias()
# Create a subquery that will calculate the maximum Post timestamp for each
# user.
subquery = (EstoqueAlias
.select(
EstoqueAlias.iddetalhe,
fn.MAX(EstoqueAlias.dtreferencia).alias('max_ts'))
@CoutinhoElias
CoutinhoElias / peewee.py
Created August 6, 2022 17:03
Solução para Join com peewee.
# Observando o Join na consulta abaixo pode observar que o nome das tabelas não se repetem
p = Estoque.select(
Detalhe.cdprincipal,
Detalhe.dsdetalhe,
Produto.stativo,
Grupo.nmgrupo,
Familia.dsfamilia,
Detalhe.vlprecocusto,
@CoutinhoElias
CoutinhoElias / my_code.py
Last active June 17, 2022 21:25
Only my code
from kivymd.uix.button import MDFillRoundFlatButton, MDRaisedButton
from kivymd.font_definitions import theme_font_styles
from kivymd.uix.label import MDLabel
import json
from kivy.lang import Builder
from kivymd.app import MDApp
from kivymd.uix.boxlayout import MDBoxLayout
from kivymd import images_path
from kivymd.uix.expansionpanel import MDExpansionPanel, MDExpansionPanelOneLine
from kivymd.uix.dialog import MDDialog
from kivymd.uix.button import MDFlatButton
from kivy.properties import ListProperty
from kivy.properties import StringProperty
from kivy.uix.screenmanager import Screen
from kivymd.uix.card import MDCard
from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.behaviors import TouchBehavior
from kivy.lang import Builder
@CoutinhoElias
CoutinhoElias / meu_peewee.py
Last active January 14, 2022 12:59
Descobrir_um_bug
from ast import Try
from peewee import *
from peewee import SqliteDatabase, Model, TextField, ForeignKeyField
import xmltodict
import glob, os
# Abre a base de dados que receberá as informações dos XML'
database = SqliteDatabase('/home/elias/Área de Trabalho/notas_emissor/NfEasy2.db')
@CoutinhoElias
CoutinhoElias / explicando_pyrebase_1.py
Last active December 24, 2022 03:30
Parte 1, explicando pyrebase.
# A primeira coisa que você deve fazer é criar seu ambiente virtual.
# Quer saber como? Assista nosso segundo vídeo desta playlist.
# Ambiente de desenvolvimento VirtualEnv:
# https://www.youtube.com/watch?v=OR0gACGD0-Q
source kivy_venv/bin/activate
# Em seguida instalaremos a biblioteca Pyrebase
pip3 install pyrebase