Skip to content

Instantly share code, notes, and snippets.

@npilk
npilk / custom-web-search-llm-alt.js
Created May 21, 2023 03:12
Alternate custom web search script that uses GPT-3.5-turbo to determine whether queries should be sent to an LLM or search engine
// Cloudflare Worker script to automatically redirect search queries based on trigger words
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
// status code for redirect response; need something that won't cache
var statuscode = 303
// defining base URLs for search engines
@npilk
npilk / custom-web-search-llm.js
Created May 21, 2023 03:11
Cloudflare Worker script to automatically route queries to search engines or an LLM based on their content.
// Cloudflare Worker script to automatically redirect search queries based on trigger words
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
// status code for redirect response; need something that won't cache
var statuscode = 303
// defining base URLs for search engines
@npilk
npilk / phone-hook.py
Created April 25, 2022 17:42
python script that toggles DNS blocking when a landline phone is taken on or off the hook (using a Raspberry Pi + door sensor)
import RPi.GPIO as GPIO
import time
import subprocess
# input/output setup for the door sensor
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.IN, pull_up_down = GPIO.PUD_UP)
is_off_hook = None
old_off_hook = None
@npilk
npilk / custom-web-search.js
Created January 17, 2022 22:04
Cloudflare Worker script for customizing web search
// Cloudflare Worker script to automatically redirect search queries based on trigger words
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
// status code for redirect response; need something that won't cache
var statuscode = 303