Skip to content

Instantly share code, notes, and snippets.

View igortrinidad's full-sized avatar
🎯
Focusing

Igor Trindade igortrinidad

🎯
Focusing
View GitHub Profile
@igortrinidad
igortrinidad / README.md
Last active February 5, 2024 01:01
How to create AWS Lambda layers using Python pipenv
@igortrinidad
igortrinidad / SocketService.ts
Last active February 3, 2024 19:50
How to start a Socket.io service in Adonis 6
import type { ApplicationService } from '@adonisjs/core/types'
export default class SocketProvider {
constructor(protected app: ApplicationService) {}
/**
* Register bindings to the container
*/
register() {}
@igortrinidad
igortrinidad / A_UUID_v7_for_Postgres.sql
Created November 24, 2024 21:19 — forked from kjmph/A_UUID_v7_for_Postgres.sql
Postgres PL/pgSQL function for UUID v7 and a bonus custom UUID v8 to support microsecond precision as well. Read more here: https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/
create or replace function uuid_generate_v7()
returns uuid
as $$
begin
-- use random v4 uuid as starting point (which has the same variant we need)
-- then overlay timestamp
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string
return encode(
@igortrinidad
igortrinidad / WhatsappManager.ts
Created December 11, 2024 19:45
Manager wpp instances with workers
import { Worker } from 'worker_threads'
import path from 'path'
import Instance from '#models/Instance'
import app from '@adonisjs/core/services/app'
export class WhatsappManager {
isBooted = false
workers = new Map()
constructor() {
@igortrinidad
igortrinidad / downloadMediaMessage.ts
Created July 9, 2025 21:11
downloadMediaMessage
import { WAMessage, downloadMediaMessage as downloadMediaSource } from '@whiskeysockets/baileys'
import { saveMediaLocally } from '#helpers/general/saveMediaLocally'
import { deepSearchKey } from '@igortrindade/lazyfy'
import mime from 'mime-types'
import logger from '@adonisjs/core/services/logger'
import { MediaDownloadResult } from './types.js'
const getMediaExtension = (message: WAMessage): { mimetype: string, extension: string } => {
const mimetype = deepSearchKey(message, 'mimetype') as string
#Qualidade razoavel - arquivo menor

ffmpeg -i \
input_tutorial.mp4 \
-vf "scale='min(1080,iw)':-2" \
-c:v libx264 \
-profile:v baseline \
-level 3.1 \