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
# based on https://github.com/margonaut/CMU-to-IPA-Converter/tree/master | |
CMU_IPA_MAPPING = { | |
"B": "b", | |
"CH": "ʧ", | |
"D": "d", | |
"DH": "ð", | |
"F": "f", | |
"G": "g", | |
"HH": "h", | |
"JH": "ʤ", |
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 tkinter as tk | |
from tkinter import ttk | |
import numpy as np | |
from scipy.integrate import solve_ivp | |
# Lorenz system equations | |
def lorenz_system(t, xyz, sigma, rho, beta): | |
x, y, z = xyz | |
return [sigma * (y - x), x * (rho - z) - y, x * y - beta * z] |
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 sys | |
import random | |
import time | |
import string | |
class AsciiCanvas: | |
width: int | |
height: int | |
fill_char: str | |
canvas: list[list[str]] |
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 math | |
import time | |
import sys | |
import random | |
class AsciiCanvas: | |
width: int | |
height: int | |
fill_char: str | |
canvas: list[list[str]] |
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 sys | |
import time | |
import math | |
import random | |
class AsciiCanvas: | |
width: int | |
height: int | |
fill_char: str |
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
# Use Ubuntu as the base image | |
FROM ubuntu:20.04 | |
# Set environment variables | |
ENV DEBIAN_FRONTEND=noninteractive | |
# Update and install dependencies | |
RUN apt-get update && \ | |
apt-get install -y --no-install-recommends \ | |
build-essential \ |
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 langchain import PromptTemplate | |
from langchain.llms import OpenAIChat | |
from langchain.chains import LLMChain, SequentialChain | |
from langchain.memory import ConversationSummaryMemory | |
import os | |
from config import openai_key | |
os.environ["OPENAI_API_KEY"] = openai_key | |
observe = """What are the current conditions or factors that are affecting Assistant? What data or information do we need to collect to understand them better? | |
History: {history} |
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
""" | |
First person shooter game in python using just tkinter canavas | |
Based on https://github.com/jdah/doomenstein-3d/blob/main/src/main_wolf.c | |
""" | |
import tkinter as tk | |
import math | |
SCREEN_WIDTH = 72 | |
SCREEN_HEIGHT = 40 |
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
""" | |
Sure, here is a ruleset for a 2d cellular automaton with 6 states that can be used to simulate fire: | |
Each cell in the grid is in one of six states: "empty", "tree", "burning", "ash", "smoke", and "firefighter". | |
At each step in the simulation, the state of each cell is updated based on the states of its neighbors according to the following rules: | |
If a cell is empty and has exactly 3 tree neighbors, it becomes a tree. Otherwise, it remains empty. | |
If a cell is a tree and has 2 or more burning neighbors, it becomes burning. Otherwise, it remains a tree. | |
If a cell is burning and has 1 or more firefighter neighbors, it becomes ash. Otherwise, it becomes smoke. |
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
Habitat.registerEverything(); | |
const pointer = getPointer(); | |
defineGetter(pointer, "x", () => pointer.position[0]); | |
defineGetter(pointer, "y", () => pointer.position[1]); | |
const stage = new Stage(); | |
const Square = struct({ x: 0, y: 0, width: 2, height: 2, color: GREY, isAlive: false, needsRedraw: true }); |
NewerOlder