Skip to content

Instantly share code, notes, and snippets.

(CC-BY-NC-SA 4.0 by karminski-牙医)

杯子倒水测试

(CC-BY-NC-SA 4.0 by karminski-牙医)

请使用Python和pygame库,创建一个二维流体模拟程序。该程序需要模拟液体(由大量粒子代表)在重力作用下从一个正在倾斜的杯子中倒出的过程。

Firecracker Chain Explosion Test

(CC-BY-NC-SA 4.0 by karminski-牙医)

Please use three.js to implement a realistic "firecracker box" 3D explosion chain reaction demonstration. All code (including HTML, CSS, JavaScript) must be encapsulated in a single, standalone HTML file.

Scene Setup:

  1. Ground Plane: Create a 1000×1000 gray, smooth horizontal plane that can receive shadows. Ground material uses {color: 0x808080, roughness: 0.8, metalness: 0.1}.

Elephant Toothpaste Test

(CC-BY-NC-SA 4.0 by karminski-牙医)

Please use three.js to implement a realistic "Elephant Toothpaste" chemical experiment 3D demonstration. All code (including HTML, CSS, JavaScript) must be encapsulated in a single independent HTML file.

Scene Setup:

  1. Ground Plane: Create a 1000*1000 gray, smooth horizontal plane that can receive shadows.
  2. Erlenmeyer Flask:
@FadedWeiss
FadedWeiss / Web Component for Copyright Years.md
Created March 29, 2024 05:32
Web Component for Copyright Years
@FadedWeiss
FadedWeiss / markov.py
Created January 10, 2024 01:16 — forked from benhoyt/markov.py
Generate text from an input using a simple Markov chain generator
import collections, random, sys, textwrap
# Build possibles table indexed by pair of prefix words (w1, w2)
w1 = w2 = ''
possibles = collections.defaultdict(list)
for line in sys.stdin:
for word in line.split():
possibles[w1, w2].append(word)
w1, w2 = w2, word
@FadedWeiss
FadedWeiss / index.html
Created December 19, 2023 15:10
Terrain coloring without a shader
<script async src="https://ga.jspm.io/npm:[email protected]/dist/es-module-shims.js" crossorigin="anonymous"></script>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/[email protected]/build/three.module.js",
"three/addons/": "https://unpkg.com/[email protected]/examples/jsm/"
}
}
</script>
@FadedWeiss
FadedWeiss / README.md
Created September 13, 2023 02:18 — forked from kfox/README.md
TCP echo server for Node.js

TCP echo server for Node.js

Usage

  1. Make sure you have a modern-ish version of Node.js installed.
  2. Type npx https://gist.github.com/kfox/1280c2f0ee8324067dba15300e0f2fd3
  3. Connect to it from a client, e.g. netcat or similar: nc localhost 9000
/*
* This is an experimental view library that would compete with react, svelte, qwik.js, vue.js etc.
*
* Implementation reference: https://git.sr.ht/~erock/alpfx
*
* Features:
* - Instead of `view = func(state)` we have `view = func(event)`
* - This paradigm shift will:
* - make prop mgmt (e.g. when to update component) more manual
* - animations easier (events or transitions are sent to the component that the end-user