Skip to content

Instantly share code, notes, and snippets.

View toshvelaga's full-sized avatar
🔥
Working on Typeblock.co

Tosh Velaga toshvelaga

🔥
Working on Typeblock.co
View GitHub Profile
@toshvelaga
toshvelaga / Broadcast.js
Created October 12, 2021 01:54
Using the Youtube Live Streaming API to go live
import React, { useState, useEffect, useRef } from 'react'
import Navbar from '../../components/Navbar/Navbar'
import BroadcastButton from '../../components/Buttons/BroadcastButton'
import Timer from '../../components/Timer/Timer'
import formatTime from '../../utils/formatTime'
import getCookie from '../../utils/getCookie'
import API from '../../api/api'
import './Broadcast.css'
const CAPTURE_OPTIONS = {
@toshvelaga
toshvelaga / DocumentUpload.js
Created August 16, 2023 21:06
Create vector embeddings using MongoDB
const mongoose = require('mongoose')
const Schema = mongoose.Schema
// Create a new schema for uploaded documents
const DocumentUploadSchema = new Schema({
title: String,
description: String,
fileName: String,
uploadDate: {
def run_inference(access_token):
url = "https://inference.datacrunch.io/v1/audio/whisperx-v2/generate"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {access_token}"
}
data = {
"audio_input": "https://audio.adjustleads.com/baltimore-city/recording_1710384621017.mp3"
}
import torch
from diffusers import StableDiffusionPipeline
import matplotlib.pyplot as plt
import time
begin = time.time()
pipe = StableDiffusionPipeline.from_pretrained(
"runwayml/stable-diffusion-v1-5",
@toshvelaga
toshvelaga / scraper.js
Created October 15, 2023 05:11
Use pupeteer to get the contents of a website
import puppeteer from 'puppeteer'
import 'dotenv/config'
// import screenshot from '../screenshot.js'
const PROD_CONFIG = {
headless: true,
ignoreHTTPSErrors: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
ignoreDefaultArgs: ['--disable-extensions'],
}
@toshvelaga
toshvelaga / nextpostrequest.js
Created July 10, 2023 02:28
NEXT JS POST REQUEST
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { NextResponse } from 'next/server'
export const runtime = 'edge'
export async function POST(req, res) {
const body = await req.json()
const { text, model } = body
@toshvelaga
toshvelaga / Everylead no code tech lookup curl
Created March 26, 2023 08:35
API that looks up whether a site uses Webflow or Bubble
curl --location --request POST 'https://wreudwglze.execute-api.us-west-1.amazonaws.com/default/techLookup' \
--header 'Content-Type: application/json' \
--data-raw '{
"url": "<PUT_COMPANY_URL_HERE>"
}'
@toshvelaga
toshvelaga / everylead.js
Last active March 19, 2023 05:22
API that checks if user is an individual or a business. If user is a business sends an email notification. javascript implementation with axios
axios.post(
'https://7a6to3aeyb.execute-api.us-west-1.amazonaws.com/default/notify',
{
email_of_user: 'USERS_THAT_REGISTERED_EMAIL_ADDRESS',
email_of_recepient: 'YOUR_EMAIL_ADDRESS_HERE',
}
)
@toshvelaga
toshvelaga / Everylead cURL
Last active March 19, 2023 05:22
API that checks if user is an individual or a business. If user is a business sends an email notification. cURL implementation
curl --location --request POST 'https://7a6to3aeyb.execute-api.us-west-1.amazonaws.com/default/notify' \
--header 'Content-Type: application/json' \
--data-raw '{
"email_of_user": "USER_THAT_REGISTERED_EMAIL_ADDRESS_HERE",
"email_of_recepient": "YOUR_EMAIL_ADDRESS_HERE"
}'
@toshvelaga
toshvelaga / everylead.py
Last active March 19, 2023 05:21
API that checks if user is an individual or a business. If user is a business sends an email notification. python implementation
import requests
import json
url = "https://7a6to3aeyb.execute-api.us-west-1.amazonaws.com/default/notify"
payload = json.dumps({
"email_of_user": "USERS_THAT_REGISTERED_EMAIL_ADDRESS",
"email_of_recepient": "YOUR_EMAIL_ADDRESS_HERE"
})
headers = {