Skip to content

Instantly share code, notes, and snippets.

View AnthonyLzq's full-sized avatar
🏠
Working from home

Anthony Luzquiños AnthonyLzq

🏠
Working from home
View GitHub Profile
@AnthonyLzq
AnthonyLzq / createSupabaseClient.ts
Created January 23, 2023 05:19
Script to integrate Supabase in TS
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = process.env.SUPABASE_URL as string
const supabaseKey = process.env.SUPABASE_KEY as string
const client = createClient(supabaseUrl, supabaseKey)
export { client }
@AnthonyLzq
AnthonyLzq / node-similarity.ts
Created January 15, 2023 17:42
Node similarity script using a CDN
import * as tfjs from '@tensorflow/tfjs-node'
import { Human, Config } from '@vladmandic/human'
import { existsSync, readFileSync } from 'fs'
const humanConfig: Partial<Config> = {
debug: true,
face: { emotion: { enabled: false } },
body: { enabled: false },
hand: { enabled: false },
gesture: { enabled: false },
@AnthonyLzq
AnthonyLzq / node-similarity.ts
Created January 15, 2023 07:49
Node similarity script in TypeScript
import * as tfjs from '@tensorflow/tfjs-node'
import { Human, Config } from '@vladmandic/human'
import { existsSync, readFileSync } from 'fs'
const humanConfig: Partial<Config> = {
modelBasePath: 'node_modules/@vladmandic/human/models',
debug: true,
face: { emotion: { enabled: false } },
body: { enabled: false },
hand: { enabled: false },
@AnthonyLzq
AnthonyLzq / node-face-compare.ts
Created January 15, 2023 06:57
Node face compare script in TypeScript
import { readFileSync } from 'fs'
import tfjs from '@tensorflow/tfjs-node'
import faceApi from '@vladmandic/face-api'
const modelUrl = 'node_modules/@vladmandic/face-api/model'
const optionsSSDMobileNet = new faceApi.SsdMobilenetv1Options({
minConfidence: 0.5,
maxResults: 1
})
@AnthonyLzq
AnthonyLzq / importingFromExternalPackage.d.ts
Created November 19, 2022 00:44
Global .d.ts file that will work without using declare global
interface Route {
sub: (client: import('mqtt').MqttClient) => void
PUB_TOPIC: string
SUB_TOPIC: string
}
@AnthonyLzq
AnthonyLzq / importingFromExternalPackage.d.ts
Created November 19, 2022 00:41
Global .d.ts file that will work using declare global
import { MqttClient } from 'mqtt'
declare global {
interface Route {
sub: (client: MqttClient) => void
PUB_TOPIC: string
SUB_TOPIC: string
}
}
@AnthonyLzq
AnthonyLzq / importingFromExternalPackage.d.ts
Last active November 19, 2022 00:37
Global .d.ts file that does not work
import { MqttClient } from 'mqtt'
interface Route {
sub: (client: MqttClient) => void
PUB_TOPIC: string
SUB_TOPIC: string
}
@AnthonyLzq
AnthonyLzq / .env
Last active September 7, 2022 15:14
Create a postgresql database using docker-compose
# docker
DB_NAME = postgresql
DB_USER = anthony
DB_PASSWORD = 14db7d47-f442-4a90-b633-2a537c8b5c13
@AnthonyLzq
AnthonyLzq / .ts
Created December 17, 2021 05:19
DtoUser
interface DtoUser {
id: string
lastName: string
name: string
}
@AnthonyLzq
AnthonyLzq / .ts
Last active December 17, 2021 04:26
Global variable declaration in Node.js >= 16
declare global {
var globalString: string
interface GlobalInterface {
value: unknown
}
type GlobalType = {
value: unknown
}