This document provides guidelines for maintaining high-quality Python code. These rules MUST be followed by all AI coding agents and contributors.
All code you write MUST be fully optimized.
"Fully optimized" includes:
| // Author: |7eter l-|. l3oling | |
| // License: MIT | |
| // Copyright: 2024 | |
| // See: https://gist.github.com/pboling/f831235a1f3c5627f0341c4bbcf37ea9 | |
| // Inspired by https://gist.github.com/RavenHursT/1dd87fb3460183b02ed1cf1dba065de8 | |
| /* | |
| Usage: | |
| 1. Add pre-requisites: |
| import os | |
| import torch | |
| import time | |
| from diffusers import DiffusionPipeline, AutoencoderTiny | |
| from collections import namedtuple | |
| PredictionResult = namedtuple('PredictionResult', [ | |
| 'latents', | |
| 'step', | |
| 'steps', |
| # Clone llama.cpp | |
| git clone https://github.com/ggerganov/llama.cpp.git | |
| cd llama.cpp | |
| # Build it | |
| make clean | |
| LLAMA_METAL=1 make | |
| # Download model | |
| export MODEL=llama-2-13b-chat.ggmlv3.q4_0.bin |
| import os | |
| os.environ["OPENAI_API_KEY"] = "" | |
| from flask import Flask, Response, request | |
| import threading | |
| import queue | |
| from langchain.chat_models import ChatOpenAI | |
| from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler | |
| from langchain.schema import AIMessage, HumanMessage, SystemMessage |
| import { writable } from "svelte/store" | |
| const createStore = () => { | |
| let state = { | |
| } | |
| const { subscribe, set, update } = writable(state) |
I am assuming you are here because like me, you installed a bazillion different python interpreters on mac and the whole thing is a spagetti. Today, I finally fixed my python installation. Whatever I install for python2 or python3 using pip JUST.WORKS.. My god! finally.
Here is what I had messed up, which you also probably did:
| brew install caddy mkcert nss dnsmasq | |
| mkcert -install | |
| mkcert '*.app.test' '*.cdn.test' | |
| # rename the certs and move them under /usr/local/etc/caddy/certs | |
| cat <<EOF > /usr/local/etc/caddy/Caddyfile | |
| *.app.test:443, *.cdn.test:443 { |
This is a compiled list of falsehoods programmers tend to believe about working with time.
Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.
| dl { | |
| display: grid; | |
| grid-template: auto / 200px 1fr; | |
| } | |
| dt, dd { | |
| margin: 0; | |
| } | |
| dt { | |
| background-color: #eee; | |
| } |