Skip to content

Instantly share code, notes, and snippets.

export async function sendSkeet({ text, agent, attatchments }: {
text: string,
agent: bsky.BskyAgent,
attatchments?: Attatchments,
}) {
const rt = new RichText({ text });
await rt.detectFacets(agent);
const post: any = {
$type: 'app.bsky.feed.post',
import bsky from '@atproto/api';
const { BskyAgent, RichText } = bsky;
import * as dotenv from 'dotenv';
import process from 'node:process';
dotenv.config();
const agent = new BskyAgent({
service: 'https://bsky.social',
});
import { BskyAgent, AtpSessionEvent, AtpSessionData } from '@atproto/api'
//https://github.com/bluesky-social/atproto/tree/main/packages/api
const bsAgent = async () => {
const agent = new BskyAgent({
service: 'https://bsky.app/',
persistSession: (evt: AtpSessionEvent, sess?: AtpSessionData) => {
// store the session-data for reuse
}
<?php
add_filter('get_default_comment_status', [
IM_M_Comments::class, 'get_default_comment_status'
], 100, 3 );
apply_filters( 'comments_open', [
IM_M_Comments::class, 'comments_open'
], 100, 2 );
class IM_M_Comments {
@Shelob9
Shelob9 / download-yt-transcribe.py
Created April 22, 2023 20:34
Download YouTube video's audio and transcribe with Whisper
import pytube as pt
import whisper
# download mp3 from youtube video (Two Minute Papers)
yt = pt.YouTube("https://www.youtube.com/watch?v=dd1kN_myNDs")
stream = yt.streams.filter(only_audio=True)[0]
stream.download(filename="audio_english.mp3")
# load large wisper model
model = whisper.load_model("large")
# transcribe
from openai import Model, Engine
from gpt_index.composability import ComposableGraph
from gpt_index.readers import GithubRepositoryReader
from gpt_index import download_loader,GPTTreeIndex,Document,MockLLMPredictor,GPTListIndex,PromptHelper,GPTSimpleVectorIndex, LLMPredictor, SimpleDirectoryReader
from dotenv import load_dotenv
from pathlib import Path
from prepare import unmark
load_dotenv()
import os
//https://raw.githubusercontent.com/imaginarymachines/ufo-ai-wp/75803f4a44158a51f9f77b740ae4065417492d0e/src/api/checkConnection.js
import React from 'react';
import apiFetch from '@wordpress/api-fetch';
const checkConnection = async () => {
const is = await apiFetch( {
path: '/ufo-ai/v1/connected',
method: 'GET',
} )
.then( ( res ) => {
if ( res ) {
@if (Route::has('login'))
<div class="hidden fixed top-0 right-0 px-6 py-4 sm:block">
@auth
<a href="{{ url('/dashboard') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Dashboard</a>
@else
<a href="{{ route('login') }}" class="text-sm text-gray-700 dark:text-gray-500 underline">Log in</a>
@if (Route::has('register'))
<a href="{{ route('register') }}" class="ml-4 text-sm text-gray-700 dark:text-gray-500 underline">Register</a>
@endif
@Shelob9
Shelob9 / client.js
Last active December 14, 2022 15:38
Using a WordPress REST API route to proxy request to thrid party API, so api key isn't needed in client https://twitter.com/UpTheIrons1978/status/1602938132244094976
$.post( url_of_wp_endpoint, {email: '[email protected]' } );
@Shelob9
Shelob9 / docker-compose.yml
Created December 7, 2022 20:33
Add new environment variable, from .env file, to Laravel sail, in docker-compose file https://laravel.com/docs/9.x/sail
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.1
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.1/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports: