Skip to content

Instantly share code, notes, and snippets.

View twelsh37's full-sized avatar
🎯
Focusing

Tom Welsh twelsh37

🎯
Focusing
  • The Aiaa Consultants Ltd
View GitHub Profile
@twelsh37
twelsh37 / dev-deploy-output
Created November 2, 2025 06:26
Ansible development environment install
❯ ./deploy-backend dev
==========================================
DungBeetle Backend Deployment
==========================================
Environment: dev
Inventory: /Users/twelsh37/data/projects/deep-web-crawl/ai_docs/refs/ansible/hosts.yml
Playbook: /Users/twelsh37/data/projects/deep-web-crawl/ai_docs/refs/ansible/playbooks/deploy-backend.yml
Press Ctrl+C to cancel, or Enter to continue...
@twelsh37
twelsh37 / ollama-weighted-performance-cost-per-token.js
Created January 10, 2025 17:20
How much does it cost to generate a token on each of these three systems
const data = [
{ Name: "M4 Max Macbook", TPS: 203.87, Price: 5694.00 },
{ Name: "PC", TPS: 338.08, Price: 5600 },
{ Name: "Mac Mini", TPS: 63.59, Price: 599 }
];
// Constants for normalization
const maxTPS = Math.max(...data.map(item => item.TPS));
const maxPrice = Math.max(...data.map(item => item.Price));
@twelsh37
twelsh37 / ImageObjectDetectorTool.py
Created June 4, 2024 18:58
Image Object Detector
@tool
def ImageObjectDetectorTool(arguments: dict) -> str:
"""A tool for identifying objects in images. The input will be a dictionary with two keys:
- The first [IMAGE_PATH] will be the full path of an image file.
- The second [TEXT_PROMPT] will be replaced by the string query describing the object/s to identify in the image.
To use this tool just call ImageObjectDetectorTool(dictionary) replacing dictionary by {"IMAGE_PATH": value, "TEXT_PROMPT": value}
variables by their values.
The output will the a path with an image file with the identified objects overlayed in the image.
"""
print("Tool activated:", arguments) # just to see if the agent achieves to enter into this tool
@twelsh37
twelsh37 / read_text.py
Created May 31, 2024 14:04
Using keyboard and readchar libs read in multi line text until the user hits SHIFT + ENTER
def read_text() -> list[str]:
"""
Allows the user to enter a multiline string ending by pressing Shift+Enter.
Returns:
list[str]: The multiline string entered by the user.
"""
print("Start typing your text. Press 'Shift+Enter' to finish.")
multiline = list[str]()
line = ''
while True:
@twelsh37
twelsh37 / solar_system.py
Created May 14, 2024 11:28
model of solar system generated from GPT-4o prompt
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
import numpy as np
# Define the planets and their properties
planets = [
{"name": "Mercury", "radius": 0.1, "semi_major_axis": 2.0, "eccentricity": 0.205, "color": (0.5, 0.5, 0.5), "orbit_speed": 4.15},
{"name": "Venus", "radius": 0.15, "semi_major_axis": 2.5, "eccentricity": 0.007, "color": (1.0, 0.5, 0.0), "orbit_speed": 1.62},