Skip to content

Instantly share code, notes, and snippets.

View pdaug's full-sized avatar

Pedro Augusto pdaug

View GitHub Profile
require(Modules.Avatar);
VoxEngine.addEventListener(AppEvents.Started, function () {
const data = JSON.parse(VoxEngine.customData() || "{}");
const call = VoxEngine.callPSTN(data.leadPhone, data.userPhone);
const language = VoiceList.Microsoft.Neural?.[data?.voice];
// Ligação conectada
call.addEventListener(CallEvents.Connected, function (event) {
Logger.write("call connected");
import { useEffect, useRef, useState } from "react";
// type
export type AudioDeviceOption = { id: string; value: string; label: string };
const useAudioDevice = function () {
const audioStreamRef = useRef<MediaStream | null>(null);
const [audioInputOptions, setAudioInputOptions] = useState<AudioDeviceOption[]>([]);
const [audioOutputOptions, setAudioOutputOptions] = useState<AudioDeviceOption[]>([]);
import sharp from "sharp";
import fileTyper, { FileTypeResult } from "file-type";
import { statSync, readFileSync, existsSync } from "fs";
// utils
import Hash from "./Hash";
import Logger from "./Logger";
export type MetadataInfo = {
size: number;
import { IncomingHttpHeaders } from "http";
// types
import { RequestExtended } from "../types/Request";
import { TypeUserAgentBrowser, TypeUserAgentDevice, TypeUserAgentSystem } from "../types/Utils";
/**
* Class for detecting information about the browser and device from the User-Agent header.
*
* @class
function countDeepDifferences(a: any, b: any): number {
// Se tipos diferentes, ou valor primitivo diferente
if (typeof a !== typeof b || a === null || b === null) {
return a === b ? 0 : 1;
}
// Comparar arrays
if (Array.isArray(a) && Array.isArray(b)) {
const length = Math.max(a.length, b.length);
let count = 0;
@pdaug
pdaug / audio_to_pcm.js
Last active January 22, 2025 22:27
Convert Audio Chunk to Audio PCM and Convert Audio PCM to Audio Base64 Data
/**
* Convert Audio Chunk to Audio PCM 16Bit 24kHz Mono
* (Required audio/wav and 24kHz Mono)
*
* @param {Float32Array<ArrayBufferLike>} chunk
* @returns {Int16Array<ArrayBuffer>}
*/
const chunkToPCM = function (chunk) {
const minimalInt = 0x8000;
const maximalInt = 0x7fff;
import { defineConfig } from 'vite';
import { resolve } from 'path';
import fs from 'fs';
// Função para gerar o manifest.json dinâmico
function generateManifest(subdomain) {
const baseManifest = {
name: 'My App',
short_name: 'App',
start_url: '/',
const size = 5;
const list = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21];
const totalPage = Math.ceil(list.length / size);
const paginate = [];
list.map((item, index) => {
const indexPage = Math.trunc(index / size);
internauta
teletrabalho
surfar na web
eu traabalho numa pontocom
<body class="text-natural text-size-standard bg-neutral-light transition-all" style="">
<div id="root"><div class="inset-0 bg-neutral-light flex flex-col h-screen w-screen overflow-hidden"><div class="bg-highlight border-b border-neutral flex justify-center h-24 shadow-style-cloud transition-all"><div class="w-desktop flex gap-8 justify-between"><div class="flex justify-center items-center gap-4"><div class="w-14 h-14 rounded-type-bend overflow-hidden"><img id="menuLogo" loading="lazy" src="/media/logo-black.png" alt="Logo TrackerNet"></div><div class="flex justify-center"><a class="" href="/dashboard"><div class="relative flex font-light items-center justify-center cursor-pointer w-24 h-24 transition-all text-natural"><span class="select-none text-size-highlight">Dashboard</span></div></a><a class="" href="/devices"><div class="relative flex font-light items-center justify-center cursor-pointer w-24 h-24 transition-all text-natural"><span class="select-none text-size-highlight">Dispositivos</span></d