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 / 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 / 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 / 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 / README.md
Last active February 5, 2024 01:01
How to create AWS Lambda layers using Python pipenv
@igortrinidad
igortrinidad / MultipartUploadService.ts
Created January 21, 2024 20:02
Multipart upload chunk
import Application from '@ioc:Adonis/Core/Application'
import fs from 'fs'
import fsPromises from 'fs/promises'
import ffmpeg from 'fluent-ffmpeg'
export default class MultipartUploadService {
public stream: any = null
public file_name: string = ''
public chunk_index: number = 0
@igortrinidad
igortrinidad / Currencies.json
Last active December 16, 2024 11:37
Global currencies json array
[
{
"symbol": "$",
"name": "US Dollar",
"symbol_native": "$",
"decimal_digits": 2,
"rounding": 0,
"code": "USD",
"name_plural": "US dollars"
},
@igortrinidad
igortrinidad / Installation.md
Last active July 6, 2022 10:03
Install android cmdline-tools on wsl ubuntu to build Cordova Apps

Install android cmdline-tools on wsl ubuntu to build Cordova Apps

Notice! Run one command line at a time

After I have discovered the wonder called VS Code, I have been hooked to it. It's my goto editor for any project now. The convenience of having file browsing, editing with plethora of extensions, integrated terminal, and on top of that the existence of WSL means I do not need to switch Windows often. It takes the clutter out of my way.

However, this post is not about VS Code. It is about how to setup Android SDK on WSL, so that Android development can be done in a Linux system without actually having an access to one. And move the entire development work to VS Code instead of Android studio.

USUAL GOOGLE SEARCHES

If you search on Google on how to achieve this, most likely this gist will be in top five results. It covers the most crucial points, but it is a little old by now.

@igortrinidad
igortrinidad / TailwindCarouselSwiper.vue
Created November 18, 2021 21:15
Tailwind Carousel Swiper Example
<template>
<ReportWithHeader
:title="getSelectedPlayer ? getSelectedPlayer.name : ' '"
>
<div class="h-full w-full relative overflow-x-hidden rounded" id="swiper-section">
<div class="w-full h-full absolute z-20 flex items-center justify-between">
<button
@click="setPlayer('left')"
:disabled="selectedPlayerIndex == 0"
class="rounded-full bg-smoke flex items-center justify-center p-1 text-white">
<template>
<div class="flex justify-center w-full h-full p-3 rounded-b-lg">
<div
class="flex flex-col items-center justify-center mx-2 cursor-move"
v-for="(option, index) in game.options"
:key="option.id"
draggable="true"
@dragstart="dragStart(index)"
@dragover="dragOver(index)"
@dragend="dragEnd"
@igortrinidad
igortrinidad / Dockerfile
Created December 16, 2020 00:56
CEE Docker setup with postgres, redis, nginx e certbot
FROM node:13.7.0
USER root
WORKDIR /app
COPY package*.json ./
RUN npm install