Skip to content

Instantly share code, notes, and snippets.

View kfsone's full-sized avatar

Oliver Smith kfsone

View GitHub Profile
@kfsone
kfsone / CMakeLists.txt
Created November 28, 2024 10:11
Benchmark python invocation without arguments
# I'm using gcc 14, Ninja Build and cmake 3.21
# cmake -G Ninja -S . -B out -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON
# cmake --build out
# ./out/bench
cmake_minimum_required (VERSION 3.17)
project (bench LANGUAGES C)
add_executable (bench bench.c)
if (MSVC)
@kfsone
kfsone / reformat.py
Created May 12, 2024 22:32
Experimental listings.csv reformat
import os
VERSION = 1
EPOCH = 1700000000
# id,station_id,commodity_id,supply,supply_bracket,buy_price,sell_price,demand,demand_bracket,collected_at
# 1,128000000,128049152,0,-1,0,81368,901,-1,1715284476
# Trade Dangerous Data Listing Format:
# Trade-Dangerous Data Listing, based on jsonl.
# line 1: dict describing the listing
@kfsone
kfsone / preceeding python
Created February 6, 2024 23:06
I DONT WANNA WRITE COMMENTS
Write a rust program that takes counts the number of non-whitespace characters outside of c++ style comments in files. Count stdin unless file name arguments are supplied. Output only the total count, unless "--verbose" or "-v" is specified as an argument, in which case list the count per file, followed by the total.
Run with no arguments, and 0 characters: output = "0"
Run with "-v", 0 files, 0 characters: output = "<stdin>: 0"
Run with 0-byte files file1, file2, file3: output = "0"
Run with 0-byte files file1, file2, file3, and "-v": output = "file1: 0
file2: 0
file3: 0\*total:
"
@kfsone
kfsone / gist:fd27109635ede39d50b31115f3932f04
Created February 5, 2024 21:38
Autogen exercise using autobuild to write rust
building_task = """
Generate a set of agents to design, develop, document and test a complete rust program minus version control.
Ensure there is an agent who writes any generated command/configuration/scripts to disk, and a separate, dedicated executor agent who runs commands via docker, so that the agents cannot simply pretend to be writing code.
"""
agent_list, agent_configs = builder.build(building_task, llm_config)
@kfsone
kfsone / research.py
Created December 1, 2023 22:48
Product-Research-Agent-Team
import autogen
from textwrap import dedent
import os
try:
del os.environ['OPENAI_API_BASE']
except:
pass
os.putenv("OPENAI_API_BASE", "http://localhost:5000")
(venv) root@b7e76e6d82d8:/workspace# echo $OPENAI_API_BASE
http://localhost:11434/
(venv) root@b7e76e6d82d8:/workspace# litellm --test --port ${LITELLM_PORT}
LiteLLM: Making a test ChatCompletions request to your proxy
An error occurred: OpenAIException - Error code: 401 - {'error': {'message': 'Incorrect API key provided: none. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Debug this by setting `--debug`, e.g. `litellm --model gpt-3.5-turbo --debug`
INFO: 127.0.0.1:35604 - "POST /chat/completions HTTP/1.1" 200 OK
@kfsone
kfsone / Dockerfile
Last active June 12, 2024 11:24
WIP Dockerfile for litellm + ollama + memgpt + autogen + jupyter
# Work in progress. V0.1
# ALL THE THINGS.
ARG APT_PROXY #=http://apt-cacher-ng.lan:3142/
ARG PIP_INDEX_URL #=http://devpi.lan:3141/root/pypi/+simple
ARG PIP_TRUSTED_HOST #=devpi.lan
ARG JUPYTER_PORT=37799
ARG LITELLM_PORT=11111
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 as build-llama
@kfsone
kfsone / morpheddircopy.py
Created November 2, 2023 18:55
MorphedDirCopy.py
# Credit: AutoGPT using OpenAI gpt4
import argparse
import json
import os
import random
import shutil
from pathlib import Path
from random import randint