This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Mini 3D Kart Game</title> | |
<style> | |
html, body { | |
margin: 0; | |
overflow: hidden; | |
background: #000; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glfw | |
from OpenGL.GL import * | |
from OpenGL.GLU import * | |
import math | |
# pip install glfw PyOpenGL PyOpenGL_accelerate | |
class FPSCamera: | |
""" | |
An FPS-style camera that processes input and calculates the corresponding Euler Angles, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Enhanced File Browser using GLFW and ImGui | |
A modern, intuitive file browser with proper error handling, visual feedback, | |
navigation with expandable folder tree and content pane. | |
""" | |
import os | |
import sys | |
import stat | |
from pathlib import Path | |
from typing import Dict, Set, Optional, Tuple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: https://gist.github.com/g023 | |
# Link for this file: https://gist.github.com/g023/1ec7723745b17fec80f665951bca3d75 | |
# Convert text in an image to a text string. | |
import requests | |
import base64 | |
import json | |
server_url = "http://localhost:11434/api/generate" | |
model = "qwen2.5vl:7b-q4_K_M" | |
prompt = "Extract all the text from this image and present it as a single string." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: g023 - https://gist.github.com/g023 | |
import cv2 | |
import numpy as np | |
from datetime import datetime | |
import os | |
import logging | |
# Configure logging | |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | |
logger = logging.getLogger(__name__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Thinking Deep Explorer - Communicate with Thoughts | |
# This program is a chat interface for the Ollama server. | |
# In this chat, you communicate in the model's thoughts, and the model responds with its thought process. | |
# Answers are forced by requesting "answer: <further answer instructions>" for a generic non-thinking response. | |
# When in thinking response mode, only the thoughts will be presented. | |
# Thoughts are passed forward as the conversation continues. | |
# You can save by typing "save" and load by typing "load". | |
# You can also clear the conversation by typing "clear" | |
# Remove the last thought by typing "remove". | |
# Chat with a model directly in its thoughts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from unsloth import FastLanguageModel | |
import torch | |
from trl import SFTTrainer | |
from transformers import TrainingArguments | |
import datasets | |
import os | |
# description: This script allows users to interact with a language model, | |
# either querying it or fine-tuning it with new data. The model is loaded | |
# from a specified directory, and the user can choose to keep or replace |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: This script is a simple n-gram text predictor that uses a frequency-based approach to predict the next token in a sequence. It can be trained on text files and can generate text based on the learned frequencies. The script also includes functions for processing text files, cleaning data, and generating text based on user input. | |
# generates from all .txt files in a ./docs/ directory that is a directory in the same file this script is run. | |
# will reduce power of model on multiple passes to help reduce and trims some of the bottom feeders. | |
# Uses: Tiktoken for tokenization, multiprocessing for parallel processing, and chardet for encoding detection. | |
# pip install tiktoken chardet | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def predict_next_token(sequence, ngram_freq, max_n=3): | |
for n in range(min(max_n, len(sequence) + 1), 0, -1): | |
context = tuple(sequence[-(n - 1):]) if n > 1 else () | |
if context in ngram_freq[n]: | |
next_tokens = ngram_freq[n][context] | |
tokens, weights = zip(*next_tokens.items()) | |
return random.choices(tokens, weights=weights, k=1)[0] | |
# Fallback to most frequent unigram |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Just a simple class to handle a vector db instance for RAG with a manager class to handle multiple instances at once while sharing the model between instances. | |
# ability to save/load (saves as a pickle file) the vector db instance to disk (in folder ./_data/{md5}.pkl) | |
# ability to share model between instances for memory efficiency and speed of loading | |
# reference target RAG db with an id. | |
# -- now in turbo (batch) mode for adding segments to the db instance (much faster) | |
# -- automatically uses GPU if available | |
# -- added ability to load a file | |
# -- added multiple chunking strategies for documents (by sentences or by words using a sliding window with overlap) | |
# -- Just query like an LLM |
NewerOlder