Skip to content

Instantly share code, notes, and snippets.

View YuriFontella's full-sized avatar
💭
sad dev

Yuri Fontella YuriFontella

💭
sad dev
  • Porto Alegre - RS
View GitHub Profile
import asyncio
import logging
from pathlib import Path
from contextlib import asynccontextmanager
from enum import Enum
from litestar import Litestar, get, post, Controller, Request, Response, Router, WebSocket, websocket, MediaType
from litestar.types import ASGIApp, Scope, Receive, Send
from litestar.datastructures import State
@YuriFontella
YuriFontella / webhook.py
Created March 16, 2024 01:44
starlette and hmac
from starlette.applications import Starlette
from starlette.responses import JSONResponse, Response
from starlette.requests import Request
from starlette.routing import Route
import hmac
import hashlib
import secrets
import sqlite3
@YuriFontella
YuriFontella / tortoise-library.py
Last active March 1, 2024 18:30
relationship prefetch related name
import asyncio
from tortoise import Tortoise, fields
from tortoise.connection import connections
from tortoise.models import Model
class Author(Model):
id = fields.IntField(pk=True)
name = fields.CharField(max_length=255)
import httpx
import asyncio
from fastapi import FastAPI, Request
from tortoise import Tortoise, Model, fields, connections
from WPP_Whatsapp import Create
from urllib.parse import parse_qs
from contextlib import asynccontextmanager
sudo apt install libedit-dev libssl-dev libffi-dev lzma bzip2 sqlite3 zlib1g-dev build-essential
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
pyenv install 3.12.2
const xlsx = require('xlsx')
const { Writable, Transform } = require('stream')
const fs = require('fs')
const path = require('path')
console.log('início')
const workbook = xlsx.readFile('data-600.xlsx', { sheetStubs: true })
@YuriFontella
YuriFontella / http.js
Last active December 4, 2022 21:45
composable axios vue
import { inject, reactive, toRefs } from 'vue'
import { Cookies, Notify } from 'quasar'
export function useHttp() {
const state = reactive({
loading: false, data: null
})
(async () => {
console.time()
async function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
const time = 2000
const total = 2
//EMBEDD THE FRESHDESK MESSAGING MESSENGER CODE ON YOUR WEBSITE
// Start talking to your website visitors by embedding this code on your website. Remember, nothing will work until you do.
// Add the following script to your website's HTML source code before the end of the BODY tag. Add the script to each page where you want the messenger to appear. For setup instructions, see the
// Docs - https://freshchat.readthedocs.io/en/latest/intro.html
<script>
function initFreshChat() {
window.fcWidget.init({
[
{
"id": "01coin",
"symbol": "zoc",
"name": "01coin"
},
{
"id": "0-5x-long-algorand-token",
"symbol": "algohalf",
"name": "0.5X Long Algorand Token"