What it is
A single Java file, but every one of its 314 lines is commented out — nothing in it would run or compile as-is.
Mold_Tray.stl
Drag to orbit, scroll to zoom, and switch to wireframe to see the mesh underneath.
A single Java file, but every one of its 314 lines is commented out — nothing in it would run or compile as-is.
A scrapbook of snippets in several languages: Python battery/multiprocessing examples, Java-calls-Python approaches (GraalPython, ProcessBuilder, Jython), plain HTML pages, and JavaScript DOM code.
Some handwritten maths jottings with trig and log terms, and a leftover 'Hello World' template from an online compiler.
Tell me which snippet matters and I'll turn that one idea into working code — as it stands the file is notes, not a program.
This is the ProcessBuilder approach from your file, finished so it compiles and runs: Java launches script.py, reads its output line by line, then reports the exit code. Java and Python can't run inside a web page, so the console below plays back the exact same lines from a line-for-line port of the script.
import java.io.*;
public class PythonProcess {
public static void main(String[] args) throws Exception {
// Pass the command and script arguments
ProcessBuilder pb = new ProcessBuilder("python", "script.py", args[0]);
pb.redirectErrorStream(true);
Process process = pb.start();
// Read the output from the Python script
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
int exitCode = process.waitFor();
System.out.println("Exited with code: " + exitCode);
}
}import sys
name = sys.argv[1] if len(sys.argv) > 1 else "world"
print("Hello " + name)
score = 90
if score >= 50:
print("You passed!")
else:
print("Try again!")
for i in range(3):
print("Looping...")// press Run to see the program output
Your snippet spreads four heavy sums across a pool of processes. Here the same four tasks run across four background threads in your browser, each summing i² for ten million numbers — and you can compare it against doing all four one after another.
from multiprocessing import Pool
import time
# A heavy, CPU-bound calculation
def heavy_calculation(n):
return sum(i * i for i in range(n))
if __name__ == "__main__":
numbers = [10_000_000, 10_000_000, 10_000_000, 10_000_000]
start_time = time.time()
# Create a pool of workers matching your core count
with Pool() as pool:
results = pool.map(heavy_calculation, numbers)
print(f"Results: {results}")
print(f"Time taken: {time.time() - start_time:.2f} seconds")// press a button to run 4 x sum(i*i for i in range(10,000,000))
Totals are shown in scientific notation — the exact sum is larger than a JavaScript number tracks precisely.
Your notes repeat one shape four times: e·sin(1) on the left, and tan(des) combined with y·cos(e) on the right using +, -, x and ÷. Here e is Euler's number and d, s, y are yours to set, so you can see which operator makes both sides meet.
left side e·sin(1) = 2.287355
Δ is how far each version sits from the left side — the smallest Δ is the closest match.
The page from your notes is rendered below, browser defaults and all. The two buttons run the page-editing snippets from the same file: one drops in a profile card, the other appends a paragraph of plain text into #container.
The battery snippet from your notes, wired up for real: the numbers below come from this device and refresh as it charges or drains. The Python lines counted CPU cores and sampled load, so alongside it you get the browser's own core count and a live busyness reading.
1
The browser's answer to os.cpu_count().
off
Reading battery status…
// 1. Check if the Battery API is supported by the browser
if ('getBattery' in navigator) {
navigator.getBattery().then((battery) => {
function updateBatteryStatus() {
console.log(`Battery Level: ${battery.level * 100}%`);
console.log(`Is Charging: ${battery.charging ? "Yes" : "No"}`);
console.log(`Time until charged: ${battery.chargingTime} seconds`);
console.log(`Time until empty: ${battery.dischargingTime} seconds`);
}
updateBatteryStatus();
battery.addEventListener('levelchange', updateBatteryStatus);
battery.addEventListener('chargingchange', updateBatteryStatus);
battery.addEventListener('chargingtimechange', updateBatteryStatus);
battery.addEventListener('dischargingtimechange', updateBatteryStatus);
}).catch((error) => {
console.error("Error accessing the Battery API:", error);
});
} else {
console.log("The Battery Status API is not supported on this browser.");
}import os
# Get the total number of available logical CPUs
cores = os.cpu_count()
print(f"Total CPU cores: {cores}")
import psutil
# Get CPU usage as a percentage over a 1-second interval
print(f"Current CPU Usage: {psutil.cpu_percent(interval=1)}%")
# Monitor CPU usage per individual core
print(f"Usage per core: {psutil.cpu_percent(interval=1, percpu=True)}")