This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { type NextApiRequest, type NextApiResponse } from 'next'; | |
import Ffmpeg from 'fluent-ffmpeg'; | |
export default function handler(req: NextApiRequest, res: NextApiResponse) { | |
if (req.method === 'GET') { | |
// Set response headers | |
res.setHeader('Content-Type', 'video/mp4'); | |
res.setHeader('Connection', 'keep-alive'); | |
res.setHeader('Accept-Ranges', 'bytes'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createToolsFromOpenAPISpec, runWithTools } from "@cloudflare/ai-utils"; | |
export default { | |
async fetch(request, env, ctx) { | |
const response = (await runWithTools( | |
env.AI, | |
"@hf/nousresearch/hermes-2-pro-mistral-7b", | |
{ | |
messages: [ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await runWithTools(env.AI, "@hf/nousresearch/hermes-2-pro-mistral-7b", { | |
messages: [ | |
{ role: "system", content: "Put user given values in KV" }, | |
{ role: "user", content: prompt }, | |
], | |
tools: [ | |
{ | |
name: "KV update", | |
description: "Update a key-value pair in the database", | |
parameters: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let tweets = []; // Initialize an empty array to hold all tweet elements | |
const scrollInterval = 1000; | |
const scrollStep = 5000; // Pixels to scroll on each step | |
let previousTweetCount = 0; | |
let unchangedCount = 0; | |
const scrollToEndIntervalID = setInterval(() => { | |
window.scrollBy(0, scrollStep); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rich import print | |
import time | |
FORBIDDEN_CHARS = ["⍼", "⳧"] | |
text= "really really really long text that has a lot of repeating stuff so that it can be coompressed" | |
def find_all_non_overlapping_repeating_substrings(text: str): | |
text = (text + ' ') if text[-1] != ' ' else text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
text = """ | |
ipsum doloridk sit amet, consectetur adipiscing elit. | |
sed non risus.adiidkidk | |
suspendisse lectus tortor,adi dignissim sit amet, adipiscing nec, ultricies sed, dolor. | |
cras elementum ultrices diam.idkidkidk maecenas ligula massa, varius a, semper congue, euismod non, mi. """ | |
txt1 = "loremhehe loremhehe lorem ipsumhehe ipsum ipsum" | |
def find_all_non_overlapping_repeating_substrings(text: str): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function owofy(text: string, wanky: boolean = false) { | |
function lastReplace(s: string, old: string, newVal: string): string { | |
const i = s.lastIndexOf(old); | |
if (i < 0) { | |
return s; | |
} | |
const start = s.substring(0, i); | |
const end = s.substring(i + old.length); | |
return start + newVal + end; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytwitter | |
from os import environ as env | |
from dotenv import load_dotenv | |
load_dotenv() # Loads the .env file we created earlier | |
api = pytwitter.Api( | |
consumer_key=env["CONSUMER_KEY"], | |
consumer_secret=env["CONSUMER_SECRET"], | |
access_token=env["OAUTH_TOKEN"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio, functools, itertools, math, random | |
import spotipy, youtube_dl, discord, lyricsgenius | |
from spotipy.oauth2 import SpotifyClientCredentials | |
from async_timeout import timeout | |
from discord.ext import commands | |
from otherfiles.utils import voteembed, Votelink |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Sequence | |
def strong_british_accent( | |
text: Sequence | |
): | |
"""Converts your given string/array to a kind-of strong british accent (if you're nonsensical about it...) | |
""" | |
def brit(brsentence): | |
brsentence = brsentence.replace("it was ", "it was quite ") |
NewerOlder