Skip to content

Instantly share code, notes, and snippets.

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

skeptrune skeptrunedev

💭
🚢 🚢 🚢
View GitHub Profile
@skeptrunedev
skeptrunedev / transcrtipt-array-to-txt.ts
Created November 15, 2024 06:37
Turn an array of speaker turns into a txt file transcript using Bun
// use the below command to run the script and get the output txt file
// npm install -g bun - if you don't have bun installed
// bun run transcript-demo.ts
const transcript = [
"Where 0 = Kirill Kulakov, 1 = Yoav, 2 = skeptrune",
"0: Appreciate it.",
"1: Yeah, welcome.",
"1: So yeah.",
"1: So Nick, you know, I'd love to dive a little bit deeper.",
@skeptrunedev
skeptrunedev / md-to-html-using-github.js
Created September 17, 2024 23:10
Convert Markdown to HTML using Github API
const fs = require('fs');
const childProcess = require('child_process');
const GITHUB_ACCESS_TOKEN = process.env.GITHUB_ACCESS_TOKEN;
const inputDirectory = './docs';
const outputDirectory = './htmldocs';
fs.readdirSync(inputDirectory).filter(file => file.endsWith('.md')).forEach(file => {
@skeptrunedev
skeptrunedev / tokio-timeout-parse-element.rs
Created September 4, 2024 18:48
Tokio Timeout Code for scraper Html::parse_element function
pub async fn timeout_safe_convert_html_to_text(html: &str) -> String {
match tokio::time::timeout(std::time::Duration::from_secs(1), async {
convert_html_to_text(html)
})
.await
{
Ok(text) => text,
Err(_e) => {
log::error!("Error converting this html to text in 1s: {:?}", html);
sentry::capture_message(
@skeptrunedev
skeptrunedev / docker-build-command.sh
Created August 28, 2024 01:21
docker build command
docker build -t actix-frontend -f ./actix-frontend/Dockerfile.actix-frontend .
@skeptrunedev
skeptrunedev / get-docker-url.txt
Last active August 28, 2024 01:17
Get Docker URL
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
@skeptrunedev
skeptrunedev / history-of-hn-search.md
Last active August 12, 2024 21:42
Blog Post Documenting the History of HN Search from 2014 to 2024
publishDate author title excerpt image category tags
2024-08-12 08:45:00 UTC
skeptrune (Nick K)
History of HackerNews Search: From 2007 to 2024
The history of HackerNews (HN) search spans three generations. Starting in 2007 with Disqus founder Jason Yan followed by a series of other sites, Octopart/ThriftDB-powered HNSearch in 2011, and finally Algolia-powered search from 2014 to today.
History
hackernews
@skeptrunedev
skeptrunedev / cargo.toml
Created August 6, 2024 22:57
Rust actix-web implementation for actix-extensible-rate-limit crate (Trieve)
redis = { version = "0.25", features = [
"tokio-rustls-comp",
"aio",
"connection-manager",
] }
actix-extensible-rate-limit = { version = "0.3.1", features = ["redis"] }
@skeptrunedev
skeptrunedev / caddy-spa-config-block.yml
Created August 6, 2024 04:06
caddy-spa-config.yml
foo.bar.com {
root * /home/git_projects/trieve-hn-discovery/frontend/dist
try_files {path} {path}/ /index.html
file_server
}
@skeptrunedev
skeptrunedev / query-highlighting-system.rs
Created August 3, 2024 10:25
query-highlighting-system
// TODO: latency optimize this so it can be uncommented
if phrases.is_empty() {
let potential_query_split_whitespace = potential_query.split_whitespace().collect_vec();
if potential_query_split_whitespace.len() > 5 {
continue;
}
let query_without_stop_words = potential_query
.split_whitespace()
.filter(|word| !stop_words.contains(&word.to_lowercase()))
.collect::<Vec<&str>>();
@skeptrunedev
skeptrunedev / trieve-search-playground
Created July 25, 2024 18:26
Trieve Search Playground Screenshot
I need to upload image in comment