68
codex-cli/examples/camerascii/run.sh
Executable file
68
codex-cli/examples/camerascii/run.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/bin/bash
|
||||
|
||||
# run.sh — Create a new run_N directory for a Codex task, optionally bootstrapped from a template,
|
||||
# then launch Codex with the task description from task.yaml.
|
||||
#
|
||||
# Usage:
|
||||
# ./run.sh # Prompts to confirm new run
|
||||
# ./run.sh --auto-confirm # Skips confirmation
|
||||
#
|
||||
# Assumes:
|
||||
# - yq and jq are installed
|
||||
# - ../task.yaml exists (with .name and .description fields)
|
||||
# - ../template/ exists (optional, for bootstrapping new runs)
|
||||
|
||||
# Enable auto-confirm mode if flag is passed
|
||||
auto_mode=false
|
||||
[[ "$1" == "--auto-confirm" ]] && auto_mode=true
|
||||
|
||||
# Create the runs directory if it doesn't exist
|
||||
mkdir -p runs
|
||||
|
||||
# Move into the working directory
|
||||
cd runs || exit 1
|
||||
|
||||
# Grab task name for logging
|
||||
task_name=$(yq -o=json '.' ../task.yaml | jq -r '.name')
|
||||
echo "Checking for runs for task: $task_name"
|
||||
|
||||
# Find existing run_N directories
|
||||
shopt -s nullglob
|
||||
run_dirs=(run_[0-9]*)
|
||||
shopt -u nullglob
|
||||
|
||||
if [ ${#run_dirs[@]} -eq 0 ]; then
|
||||
echo "There are 0 runs."
|
||||
new_run_number=1
|
||||
else
|
||||
max_run_number=0
|
||||
for d in "${run_dirs[@]}"; do
|
||||
[[ "$d" =~ ^run_([0-9]+)$ ]] && (( ${BASH_REMATCH[1]} > max_run_number )) && max_run_number=${BASH_REMATCH[1]}
|
||||
done
|
||||
new_run_number=$((max_run_number + 1))
|
||||
echo "There are $max_run_number runs."
|
||||
fi
|
||||
|
||||
# Confirm creation unless in auto mode
|
||||
if [ "$auto_mode" = false ]; then
|
||||
read -p "Create run_$new_run_number? (Y/N): " choice
|
||||
[[ "$choice" != [Yy] ]] && echo "Exiting." && exit 1
|
||||
fi
|
||||
|
||||
# Create the run directory
|
||||
mkdir "run_$new_run_number"
|
||||
|
||||
# Check if the template directory exists and copy its contents
|
||||
if [ -d "../template" ]; then
|
||||
cp -r ../template/* "run_$new_run_number"
|
||||
echo "Initialized run_$new_run_number from template/"
|
||||
else
|
||||
echo "Template directory does not exist. Skipping initialization from template."
|
||||
fi
|
||||
|
||||
cd "run_$new_run_number"
|
||||
|
||||
# Launch Codex
|
||||
echo "Launching..."
|
||||
description=$(yq -o=json '.' ../../task.yaml | jq -r '.description')
|
||||
codex "$description"
|
||||
0
codex-cli/examples/camerascii/runs/.gitkeep
Normal file
0
codex-cli/examples/camerascii/runs/.gitkeep
Normal file
5
codex-cli/examples/camerascii/task.yaml
Normal file
5
codex-cli/examples/camerascii/task.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
name: "camerascii"
|
||||
description: |
|
||||
Take a look at the screenshot details and implement a webpage that uses webcam
|
||||
to style the video feed accordingly (i.e. as ASCII art). Add some of the relevant features
|
||||
from the screenshot to the webpage in index.html.
|
||||
34
codex-cli/examples/camerascii/template/screenshot_details.md
Normal file
34
codex-cli/examples/camerascii/template/screenshot_details.md
Normal file
@@ -0,0 +1,34 @@
|
||||
### Screenshot Description
|
||||
|
||||
The image is a full–page screenshot of a single post on the social‑media site X (formerly Twitter).
|
||||
|
||||
1. **Header row**
|
||||
* At the very top‑left is a small circular avatar. The photo shows the side profile of a person whose face is softly lit in bluish‑purple tones; only the head and part of the neck are visible.
|
||||
* In the far upper‑right corner sit two standard X / Twitter interface icons: a circle containing a diagonal line (the “Mute / Block” indicator) and a three‑dot overflow menu.
|
||||
|
||||
2. **Tweet body text**
|
||||
* Below the header, in regular type, the author writes:
|
||||
|
||||
“Okay, OpenAI’s o3 is insane. Spent an hour messing with it and built an image‑to‑ASCII art converter, the exact tool I’ve always wanted. And it works so well”
|
||||
|
||||
3. **Embedded media**
|
||||
* The majority of the screenshot is occupied by an embedded 12‑second video of the converter UI. The video window has rounded corners and a dark theme.
|
||||
* **Left panel (tool controls)** – a slim vertical sidebar with the following labeled sections and blue–accented UI controls:
|
||||
* Theme selector (“Dark” is chosen).
|
||||
* A small checkbox labeled “Ignore White”.
|
||||
* **Upload Image** button area that shows the chosen file name.
|
||||
* **Image Processing** sliders:
|
||||
* “ASCII Width” (value ≈ 143)
|
||||
* “Brightness” (‑65)
|
||||
* “Contrast” (58)
|
||||
* “Blur (px)” (0.5)
|
||||
* A square checkbox for “Invert Colors”.
|
||||
* **Dithering** subsection with a checkbox (“Enable Dithering”) and a dropdown for the algorithm (value: “Noise”).
|
||||
* **Character Set** dropdown (value: “Detailed (Default)”).
|
||||
* **Display** slider labeled “Zoom (%)” (value ≈ 170) and a “Reset” button.
|
||||
|
||||
* **Main preview area (right side)** – a dark gray canvas that renders the selected image as white ASCII characters. The preview clearly depicts a stylized **palm tree**: a skinny trunk rises from the bottom centre, and a crown of splayed fronds fills the upper right quadrant.
|
||||
* A small black badge showing **“0:12”** overlays the bottom‑left corner of the media frame, indicating the video’s duration.
|
||||
* In the top‑right area of the media window are two pill‑shaped buttons: a heart‑shaped “Save” button and a cog‑shaped “Settings” button.
|
||||
|
||||
Overall, the screenshot shows the user excitedly announcing the success of their custom “Image to ASCII” converter created with OpenAI’s “o3”, accompanied by a short video demonstration of the tool converting a palm‑tree photo into ASCII art.
|
||||
Reference in New Issue
Block a user