Skip to content

Instantly share code, notes, and snippets.

View skeptrunedev's full-sized avatar
💭
🚢 🚢 🚢

skeptrune skeptrunedev

💭
🚢 🚢 🚢
View GitHub Profile
@skeptrunedev
skeptrunedev / lumina-trieve-reference.py
Created May 5, 2024 00:27
lumina-trieve-reference.py
import requests
import time
import os
import json
import random
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("API_KEY")
@skeptrunedev
skeptrunedev / scrape_philosophize_this-transcripts.js
Last active April 20, 2024 03:15
Philosophize This Transcripts Scrape
window.location.replace("https://www.philosophizethis.org/transcripts")
const transcriptNodes = document.querySelector(".sqs-block.archive-block.sqs-block-archive").querySelectorAll('a[href^="/transcript/"]');
const transcriptAnchors = Array.from(transcriptNodes);
const tsNumRegex = /\b(#\w+)|(\b\d+\b)/;
const transcriptObjs = transcriptAnchors.map((transcriptAnchor) => {
const text = transcriptAnchor.innerText;
const tsNums = text.match(tsNumRegex);
@skeptrunedev
skeptrunedev / philosophize_this_episodes_scrape.js
Last active April 20, 2024 03:15
Scrape Philosophize This Podcast Links
window.location.replace("https://www.philosophizethis.org/podcasts")
const episodeNodes = document.querySelector(".sqs-block.archive-block.sqs-block-archive").querySelectorAll('a[href^="/podcast/"]');
const episodeAnchors = Array.from(episodeNodes);
const epNumRegex = /#\b(\w+)\b/;
const epObjs = episodeAnchors.map((episodeAnchor) => {
const text = episodeAnchor.innerText;
const epNums = text.match(epNumRegex);
@skeptrunedev
skeptrunedev / trieve-openapi-generator-steps.md
Last active March 28, 2024 21:02
OpenAPI JS Generation Steps
  1. npm -g install js-beautify
  2. which js-beautify then take the output and copy it
  3. export JS_POST_PROCESS_FILE=<copied-value from 2>
  4. npm -g install prettier
  5. which prettier then take the output and copy it
  6. export TS_POST_PROCESS_FILE="<copied-value from 5> --write"
  7. npx @openapitools/openapi-generator-cli generate -i openapi.json -g typescript-axios -c ./openapi-generator.yaml
  8. npm adduser
  9. npm install -g typescript
  10. npm publish --access public
@skeptrunedev
skeptrunedev / generate_trieve_ruby_client.sh
Created March 18, 2024 20:58
Generate Ruby Client With Openapi-generator
npx @openapitools/openapi-generator-cli generate -i openapi.json -g ruby -c ./openapi-generator.yaml --skip-validate-spec
@skeptrunedev
skeptrunedev / twiter-brettdg-scrape.js
Last active March 15, 2024 03:42
Trieve Brettdg Scrape
const sleepPromise = (ms) => {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, ms);
});
};
const scrollDown = async () => {
window.scrollTo(0, document.body.scrollHeight);
@skeptrunedev
skeptrunedev / trieve_better_chunker.rs
Created March 1, 2024 23:28
Trieve Good Chunker Attempt In Rust
pub fn get_sentences(text: &String) -> Vec<String> {
let split_sentence_regex = Regex::new(r"[.!?]+").expect("Invalid regex");
let sentences: Vec<String> = split_sentence_regex
.split(&text)
.map(|x| x.to_string())
.collect();
sentences
}
@skeptrunedev
skeptrunedev / trieve_create_dataset_and_add_chunks.py
Created March 1, 2024 22:41
Create a Trieve Dataset and Upload Chunks
import json
import os
import requests
from dotenv import load_dotenv
load_dotenv()
api_key = os.environ.get("API_KEY")
dataset_id = os.environ.get("DATASET_ID")
organization_id = os.environ.get("ORGANIZATION_ID")
@skeptrunedev
skeptrunedev / obsidian_plugin_scrape.js
Created March 1, 2024 05:28
obsidian plugin scrape
let pluginsArray = [];
const pluginContainers = document.querySelectorAll('.p-5.flex.flex-col.rounded-lg.bg-secondary.transition-all.hover\\:shadow-2xl.hover\\:bg-gray-800');
pluginContainers.forEach((container) => {
const title = container.querySelector('.text-lg.mb-1.font-semibold.leading-tight')?.innerText.trim() || 'No title';
const authorNameElement = container.querySelectorAll('.text-muted.text-sm')[0];
const author_name = authorNameElement ? authorNameElement.innerText.trim() : 'Unknown Author';