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 fastapi import FastAPI, Request, HTTPException | |
from pydantic import BaseModel | |
import os | |
import requests | |
app = FastAPI() | |
TELEGRAM_BOT_TOKEN = "" | |
TELEGRAM_CHAT_ID = "" |
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 sqlalchemy import Table | |
from sqlalchemy.orm import class_mapper | |
def filtrar_colunas_validas(data, table): | |
valid_columns = set(table.columns.keys()) | |
return {key: value for key, value in data.items() if key in valid_columns} | |
# Exemplo de uso | |
filtered_data = filter_valid_columns(viagem.model_dump(), viagem_cif_table) | |
stmt_viagem = insert(viagem_cif_table).values(filtered_data) |
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 contextlib import contextmanager | |
import time | |
from requests_oauthlib import OAuth2Session | |
from oauthlib.oauth2 import BackendApplicationClient | |
class TokenManager: | |
def __init__(self, client_id, client_secret, token_url, scopes): | |
self.client_id = client_id | |
self.client_secret = client_secret | |
self.token_url = token_url |
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
# AUTHOR https://github.com/viniciusccosta/ClipBarcode/blob/master/clipbarcode/digito_verificador.py | |
# ============================================================================= | |
import re | |
from abc import ABC, abstractmethod | |
from decimal import Decimal | |
from .datetime_tools import calculate_date | |
from .digito_verificador import mod10, mod11 |
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
<%* | |
function getMonday(d) { | |
d = new Date(d); | |
var day = d.getDay(), | |
diff = d.getDate() - day + (day == 0 ? -6 : 1); // ajustar quando o dia for domingo | |
return new Date(d.setDate(diff)); | |
} | |
function formatDate(date) { | |
let dd = date.getDate(); |
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 json | |
import time | |
class Office365EmailClient: | |
def __init__(self, client_id: str, client_secret: str, tenant_id: str): | |
self.client_id = client_id | |
self.client_secret = client_secret | |
self.tenant_id = tenant_id | |
self.token = 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 time | |
import jwt | |
from fastapi import Depends, HTTPException, Response, status | |
from fastapi.security import OAuth2PasswordBearer | |
from helpers.config_helper import Config | |
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token") | |
class OAuth2TokenValidation: | |
def __init__(self): |
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 accetto/ubuntu-vnc-xfce-g3 | |
USER 0 | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
RUN apt update \ | |
&& apt install -y wget gnupg2 \ | |
&& rm -rf /var/lib/apt/lists/* |
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
sed -i -e 's@Exec=/usr/bin/microsoft-edge-dev %U@Exec=/usr/bin/microsoft-edge-dev %U --no-sandbox@g' /usr/share/applications/microsoft-edge-dev.desktop | |
sed -i -e 's@Exec=/usr/bin/google-chrome-stable %U@Exec=/usr/bin/google-chrome-stable %U --no-sandbox@g' /usr/share/applications/google-chrome.desktop |
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
palavra="teste"; texto_adicional="deu certo"; for arquivo in teste*; do grep -q "$palavra" "$arquivo" && sed -i "/$palavra/ s/$/ $texto_adicional/" "$arquivo" && echo "Texto adicionado em $arquivo"; done |
NewerOlder