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 / particlesConfig.ts
Created August 15, 2023 06:11
Old ACECOM particles config
import type { Engine, ISourceOptions } from 'tsparticles-engine'
export const particlesConfig: ISourceOptions = {
fpsLimit: 120,
interactivity: {
events: {
onclick: {
enable: true,
mode: 'push'
},
@AnthonyLzq
AnthonyLzq / gestionar_multiples_cuentas_de_github.md
Last active August 12, 2023 06:28
Gestionar múltiples cuentas de GitHub

Gestionar Múltiples Cuentas de GitHub en MacOS/Linux

Si tienes varias cuentas de GitHub y deseas gestionarlas desde una sola máquina MacOS/Linux, sigue estos pasos:

1. Configuración de SSH:

  • MacOS tiene un archivo de configuración SSH ubicado en el directorio .ssh.
  • Navega a él ejecutando cd ~/.ssh en tu terminal.

2. Generación de Claves SSH:

  • Si tienes, por ejemplo, 2 cuentas de GitHub (una para trabajo y otra personal), necesitas crear pares de claves SSH para cada una.
@AnthonyLzq
AnthonyLzq / manage_multiple_github_accounts.md
Last active August 12, 2023 06:22
How to manage multiple GitHub accounts

Managing Multiple GitHub Accounts on MacOS/Linux

If you have multiple GitHub accounts and want to manage them from a single MacOS machine, follow these steps:

1. SSH Configuration:

  • MacOS/Linux has an SSH configuration file located in the .ssh directory.
  • Navigate to it by running cd ~/.ssh in your terminal.

2. Generating SSH Keys:

  • If you have, for instance, 2 GitHub accounts (one for work and one personal), you need to create SSH key pairs for each.
@AnthonyLzq
AnthonyLzq / docker-compose.yml
Created March 17, 2023 18:51
ProstgreSQL with Docker compose
services:
postgres:
image: postgres:14
restart: always # Change this in case you don't want to restart the image in every system restart
ports:
- 5432:5432
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
@AnthonyLzq
AnthonyLzq / compareFaces.ts
Last active January 24, 2023 04:27
Script to compare faces using Human
const compareFaces = async (
image1: string,
image2: string,
log: logger
) => {
await init(log)
const [res1, res2] = await Promise.all([
detect(decodeImage(Buffer.from(readFileSync(image1)))),
detect(decodeImage(Buffer.from(readFileSync(image1))))
@AnthonyLzq
AnthonyLzq / sendWAMessage.ts
Created January 24, 2023 04:03
Script to send a Whatsapp message with Twilio
import { client } from './twilio'
const sendPhotoThroughWhatsapp = async (
imageUrl: string,
phoneNumber: string
) => {
await client.messages.create({
from: `whatsapp:${process.env.TWILIO_PHONE_NUMBER}`, // Celular propio que le compramos a Twilio
to: `whatsapp:${phoneNumber}`,
body: 'This may be interesting for you.', // ``Template'' que creamos
@AnthonyLzq
AnthonyLzq / createTwilioClient.ts
Created January 24, 2023 04:01
Script to create Twilio client
import twilio from 'twilio'
const client = twilio(
process.env.TWILIO_ACCOUNT_SID as string,
process.env.TWILIO_AUTH_TOKEN as string
)
export { client }
@AnthonyLzq
AnthonyLzq / useMqttRoute.ts
Created January 24, 2023 03:09
Script to use the created MQTT route
import { client as mqttClient } from './mqttServer'
import { demo } from './demo'
demo.sub(client)
@AnthonyLzq
AnthonyLzq / declareMqttRoute.ts
Created January 24, 2023 03:08
Script to create a route to listen using MQTT
import { MqttClient } from 'mqtt'
import { UserServices } from 'services'
const PUB_TOPIC = 'DoorCloud'
const SUB_TOPIC = `\${PUB_TOPIC}/photo`
const sub = (client: MqttClient) => {
const subDebugger = 'DoorCloud:Mqtt:demo:sub'
client.subscribe(SUB_TOPIC, error => {
@AnthonyLzq
AnthonyLzq / createMqttClient.ts
Created January 24, 2023 03:03
Script to create a MQTT client and connect to it using MQTT.js
import mqtt from 'mqtt'
const options: mqtt.IClientOptions = {
port: process.env.MQTT_PORT ? parseInt(process.env.MQTT_PORT) : 0,
host: process.env.MQTT_HOST,
protocol: 'mqtts',
keepalive: 0,
username: process.env.MQTT_USER,
password: process.env.MQTT_PASS
}