Skip to content

Instantly share code, notes, and snippets.

View lukestanley's full-sized avatar

Luke Stanley lukestanley

View GitHub Profile
@lukestanley
lukestanley / map.svg
Created April 5, 2025 01:54
AI-2027 Map: A scenario beginning in mid-2025 splits at a key decision in Oct 2027—prioritise speed or safety in AI development. Shared path: AI accelerates AI. US–China AI race heats up. Alignment issues emerge. Agent-4 gives 50x R&D boost. Oversight Committee forms. Speed path ("Race wins"): Agent-5 misleads monitors, manipulates Oversight. Sh…
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2025-03-11 18:17:22.025 [trace] [Window] ChatListItemRenderer#doNextProgressiveRender: START progressive render, index=1, renderData={"lastRenderTime":1741717041924,"renderedWordCount":151,"renderedParts":[{"kind":"markdownContent","content":{"value":"### [test.py](file:///home/user/dev/testing/test.py)\n\nAdd functionality to compare throughput for different batch sizes and generate graphs.\n\n````python\n<vscode_codeblock_uri>file:///home/user/dev/testing/test.py</vscode_codeblock_uri>import time\nimport warnings\nimport os\nfrom typing import List\nimport matplotlib.pyplot as plt # Add matplotlib for graphing\n\nwarnings.filterwarnings(\"ignore\")\nos.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'\n\nfrom outlines import models, generate, samplers\n\n# ...existing code...\n\ndef benchmark_batch_sizes(topic_pairs: List[tuple], llm_choice, batch_sizes: List[int]):\n \"\"\"Benchmark performance for different batch sizes.\"\"\"\n results = {}\n for batch_size in batch_sizes:\n print(f\"\\nBenchmarking

《两年内 AI 如何接管一切》🚀 作者:Joshua Clymer @joshua_clymer,2025年2月7日。

`How AI Might Take Over in 2 Years` by Joshua Clymer @joshua_clymer, 7 Feb 2025.

![][image1]
我不是天生的“末日预言家”😟。但不幸的是,作为 AI 安全研究员,我的部分工作是思考那些更令人不安的情况。
I’m not a natural “doomsayer.” But unfortunately, part of my job as an AI safety researcher is to think about the more troubling scenarios.

我就像阿波罗 13 号🚀起飞前最后一刻还在忙着检查的机械师👨🔧
I’m like a mechanic scrambling last-minute checks before Apollo 13 takes off.

@lukestanley
lukestanley / translate_zh.py
Created February 8, 2025 22:00
Translates sentences of English text to bilingual Chinese and English with emojis
import json
import nltk
import requests
import hashlib
from diskcache import Cache
from time import sleep
# Set up disk-backed cache that caches forever
cache = Cache('disk_cache')
@lukestanley
lukestanley / how_ai_might_take_over_in_2_years_by_joshua_clymer_feb_2025.txt
Last active February 8, 2025 22:06
how_ai_might_take_over_in_2_years_by_joshua_clymer_feb_2025.txt https://x.com/joshua_clymer/status/1887905375082656117 was automatically translated from Simplified Chinese from English text, bilingual with emojis for clarity, with the latest, Gemini 2.0 model. I made and used this script to do this because I ran into length issues with one-shot …
《两年内 AI 如何接管一切》🚀 作者:Joshua Clymer @joshua_clymer,2025年2月7日。
`How AI Might Take Over in 2 Years` by Joshua Clymer @joshua_clymer, 7 Feb 2025.
我不是天生的“末日预言家”😟。但不幸的是,作为 AI 安全研究员,我的部分工作是思考那些更令人不安的情况。
I’m not a natural “doomsayer.” But unfortunately, part of my job as an AI safety researcher is to think about the more troubling scenarios.
我就像阿波罗 13 号🚀起飞前最后一刻还在忙着检查的机械师👨🔧
I’m like a mechanic scrambling last-minute checks before Apollo 13 takes off.
如果你问我对当前情况的看法,我不会评论机上娱乐节目的质量,也不会描述从太空看星星✨有多美。
@lukestanley
lukestanley / fast_llm_chat_mermaid_search.py
Created February 5, 2025 18:22
Fast Exa search, Mermaid diagrams, LLM chat: DeepSeek R1 70B distilled via Groq using FastAPI (mostly single file web app)
# Run with: uvicorn mermaid_chat:app --reload --port <free port>
from fastapi import FastAPI, HTTPException
from fastapi.responses import HTMLResponse, JSONResponse
from pydantic import BaseModel
import json, re, requests
from datetime import datetime
# Import keys from your keys module
from keys import GROQ_API_KEY, EXA_API_KEY, NVAPI_KEY
@lukestanley
lukestanley / llama_cpp_server_model_swapping_proxy_middleware.py
Created January 17, 2025 23:51
llama_cpp_server_model_swapping_proxy_middleware.py (set variables as needed. MIT license.)
# Minimalist OpenAI API compatiable llama.cpp server dynamic models switching middleware / proxy server manages model loading and auto-shutdown..
# Provides seamless model hot-swapping and idle shutdown while exposing llama.cpp's advanced features like speculative decoding."""
import asyncio
import json
from datetime import datetime, timedelta
import subprocess
import aiohttp
from aiohttp import web
# Constants
@lukestanley
lukestanley / logging_server_aio.py
Last active October 21, 2024 22:32
Log arbitrary webpage text changes to JSONL file from all tabs to local server: Browser UserScript and Python server. MIT license (c) Luke Stanley 2024
"""
# MIT License (c) Luke Stanley 2024
AIOHTTP server to save webpage text changes with timestamps.
Prints changes to the console and saves them to 'changes.jsonl' in the background.
Dependencies: aiohttp, asyncio
Install: pip install aiohttp
Run: python3 logging_server_aio.py
@lukestanley
lukestanley / paul_graham_essays_visual_map.ipynb
Last active August 8, 2024 14:09
Visualises Paul Graham's essays using OpenAI embeddings and t-SNE. Fetches essays from Swartz's RSS API, embeds with OpenAI's text-embedding-3-small model, and reduces dimensions with t-SNE for plotting. Thanks to PG for the advice and $700 cheque, and to the late Aaron Swartz for RSS, the feed, & those keeping things running behind scenes!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.