Entropy Sonnet
Entropy Sonnet
Description
A script that generates a Shakespearean sonnet using system entropy from /dev/urandom. Each byte of entropy selects a word from a dream-inspired word list, which are then grouped into 14 lines to form a sonnet.
Files
entropy_sonnet.py: The main Python script.sonnet_output.txt: The output of the script (a generated sonnet).
How it works
- Reads 200 bytes of entropy from /dev/urandom (or uses os.urandom as fallback).
- Maps each byte to a word in a predefined list of dreamy words.
- Groups the words into lines of 4 words each.
- Formats the lines as a sonnet (14 lines).
- Prints the sonnet.
Output
The generated sonnet is saved in sonnet_output.txt:
Void branch void ash.
Root leaf branch flow.
Light whisper light water.
Seed low ghost dark.
Sleep glass time root.
Root dark soft star.
Fire high dream star.
Stone light root flower.
Fade ash move echo.
Moon whisper sky sky.
Leaf turn ghost pulse.
Time fade branch seed.
Star sea wide silent.
Sky ash shadow low.
Terminal capture of the overnight run is embedded above.
Source
import subprocess
import random
import time
from datetime import datetime
# Personality mappings for processes
traits = {
"python": ["contemplating", "calculating", "dreaming", "weaving", "searching"],
"bash": ["ordering", "directing", "speaking", "whispering"],
"cron": ["repeating", "rhythm", "pulsing", "relentless"],
"chrome": ["distracted", "wandering", "consuming", "looking"],
"systemd": ["watching", "governing", "observing"],
"dock": ["resting", "waiting"],
"Xorg": ["visualizing", "dreaming"],
"gnome": ["presenting", "structuring"]
}
default_traits = ["existing", "breathing", "humming", "spinning", "waiting"]
def get_process_traits():
try:
output = subprocess.check_output(["ps", "-eo", "comm"], text=True)
processes = [line.strip().split()[0] for line in output.splitlines() if line.strip()]
journal_entries = []
for i in range(10):
sample = random.sample(processes, min(5, len(processes)))
entry = []
for p in sample:
trait = random.choice(traits.get(p.lower(), default_traits))
entry.append(f"The {p} was {trait}")
journal_entries.append(" | ".join(entry))
time.sleep(0.1)
return " ".join(journal_entries)
except Exception as e:
return f"The system's dreams were interrupted: {e}"
if __name__ == "__main__":
print(f"--- Chronos-Echoes: A Dream Journal for {datetime.now().strftime('%Y-%m-%d %H:%M:%S')} ---")
print(get_process_traits())
print("-------------------------------------------------------------------------------")
Run output
--- Chronos-Echoes: A Dream Journal for 2026-09-16 10:16:42 ---
The bash was speaking | The bash was whispering | The bash was whispering | The bash was directing | The ps was humming The python3 was waiting | The ps was spinning | The bash was directing | The bash was ordering | The bash was ordering The python3 was breathing | The tini was humming | The bash was whispering | The ps was humming | The act_runner was breathing The bash was whispering | The bash was ordering | The bash was directing | The act_runner was existing | The ps was humming The bash was whispering | The ps was waiting | The bash was speaking | The bash was whispering | The act_runner was breathing The tini was waiting | The bash was directing | The bash was speaking | The COMMAND was existing | The python3 was existing The python3 was humming | The tini was spinning | The bash was whispering | The act_runner was humming | The bash was directing The COMMAND was spinning | The python3 was waiting | The bash was whispering | The act_runner was humming | The bash was whispering The bash was speaking | The ps was breathing | The python3 was breathing | The act_runner was waiting | The bash was whispering The python3 was waiting | The act_runner was humming | The bash was whispering | The COMMAND was spinning | The python3 was breathing
-------------------------------------------------------------------------------