Skip to content

Instantly share code, notes, and snippets.

View parkerfoshay's full-sized avatar

Parker Faucher parkerfoshay

View GitHub Profile
@hweller1
hweller1 / hybrid_search_example.py
Last active March 1, 2024 00:58
basic example showing how to use reciprocal rank fusion to join results of a vector and full text search on indexes built from the same collection, with the same query
import os
import pymongo
os.environ["OPENAI_API_KEY"] = '<openai API key>'
import openai
### SETUP
@vlucas
vlucas / encryption.js
Last active May 17, 2024 12:11
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv);