Skip to content

Instantly share code, notes, and snippets.

@TheMcSebi
TheMcSebi / do_search.py
Created February 12, 2024 14:17
Perform RAGatuille search and postprocess using an LLM
from ragatouille import RAGPretrainedModel
import json, cmd, ollama # pip install ollama
# first, install ollama:
# curl -fsSL https://ollama.com/install.sh | sh
# second, download llama2:chat:
# ollama run llama2:chat
llm = "llama2:chat"
llm_context_size = 8192
@TheMcSebi
TheMcSebi / create_index.py
Created February 12, 2024 14:13
RAGatouille index creation by directory scan
from ragatouille import RAGPretrainedModel
import os, glob
RAG = RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")
def create_document_corpus(folderpath: str, filetype: str = "txt"):
my_documents = []
document_ids = []
document_metadatas = []
for i, filepath in enumerate(glob.glob(os.path.join(folderpath, f"**/*.{filetype}"), recursive=True)):
@TheMcSebi
TheMcSebi / crash_windows_from_usermode.py
Created December 12, 2021 13:46
bluescreen a windows computer
# ported from c to python only using github copilot (no google)
from ctypes import windll
from ctypes import c_int
from ctypes import c_uint
from ctypes import c_ulong
from ctypes import POINTER
from ctypes import byref
nullptr = POINTER(c_int)()