Skip to content

Instantly share code, notes, and snippets.

View TheDiscordian's full-sized avatar

TheDiscordian

  • Canada
View GitHub Profile
@TheDiscordian
TheDiscordian / pln_qa.py
Created July 2, 2023 23:40
PLN QA AI Bot
import urllib.request, time, json, datetime, socket, re, tiktoken, openai, os
import numpy as np
import pandas as pd
from openai.embeddings_utils import distances_from_embeddings
# Usage: OPENAI_API_KEY="key-here" python3 pln_qa.py
MODELS = {"text-ada-001": 0.0004, "text-babbage-001": 0.0005, "text-curie-001": 0.002, "text-davinci-001": 0.02, "gpt-3.5-turbo": (0.0015, 0.002)}
model = "gpt-3.5-turbo"
DB = 'pln_db-noembed.csv'
@TheDiscordian
TheDiscordian / bs_word-filters.js
Last active May 9, 2023 22:19
Bluesky Word Filters
// ==UserScript==
// @name Bluesky Word Filters
// @namespace https://staging.bsky.app/
// @version 0.3
// @description remove junk posts from feeds (does't hide from profiles)
// @author Discordian
// @match https://staging.bsky.app/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==
@TheDiscordian
TheDiscordian / ipfs_peeradvertiser.py
Last active September 29, 2022 17:18
Advertises the relay address of connected js-ipfs peers to a pubsub channel (announce-circuit)
import requests, json, time, threading, base64, math
# NOTE: This only works with go-ipfs v0.10.0 or *earlier* /w pubsub enabled.
# Use full path to circuit, destination will be appended (you must change these, they are node specific)
CIRCUITS = ["/dns6/ipfs.thedisco.zone/tcp/4430/p2p/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt/p2p-circuit/p2p/", "/dns4/ipfs.thedisco.zone/tcp/4430/p2p/12D3KooWChhhfGdB9GJy1GbhghAAKCUR99oCymMEVS4eUcEy67nt/p2p-circuit/p2p/"]
# The address of your local node (must be accepting websockets and be reverse proxied with SSL support for wss)
NODE = "http://localhost:5001"
# Used for trying to track already announced peers