Front / Back (click to flip)
Click card to view front/back
Raw Script
#!/usr/bin/env bash
bash -c $'set +e\ntt="/dev/tty";[[ -r "$tt" && -w "$tt" ]]||tt=""\np(){ [[ -n "$tt" ]]&&printf "%b" "$1" >"$tt"||printf "%b" "$1"; }\nr(){ local t=""; if [[ -n "$tt" ]]; then IFS= read -r t <"$tt" || t=""; else IFS= read -r t || t=""; fi; printf "%s" "$t"; }\nW=60\ndeck="EDU";subject="PHYSICS";\ntopic="How the Heart Gets Energy";\nsubtitle="Human Biology / Cardiovascular System";\nnote="The heart gets energy by using oxygen and nutrients from the blood to make fuel inside its cells. This fuel powers the heart so it can keep pumping blood all the time.";\ncl(){ printf "\\033[2J\\033[H"; }\nbar(){ printf "%s\\n" "$(printf "%*s" "$W" "" | tr " " "=")"; }\nrow(){ printf "| %-*.*s |\\n" "$((W-4))" "$((W-4))" "$1"; }\nwrap(){\n local txt="$1" max=$((W-4)) chunk rest cut\n while [[ -n "$txt" ]]; do\n if [[ ${#txt} -le $max ]]; then row "$txt"; break; fi\n chunk=${txt:0:$max}\n rest=${txt:$max}\n if [[ "$chunk" =~ (.+)[[:space:]] ]]; then\n cut=${BASH_REMATCH[1]}\n row "$cut"\n txt="${txt:${#cut}}"; txt="${txt#" "}";\n else\n row "$chunk"\n txt="$rest"\n fi\n done\n}\npause(){ p "Press Enter to continue: "; r >/dev/null; }\nmenu(){\n cl\n bar; row "$deck • $subject"; bar\n wrap "$topic"\n wrap "$subtitle"\n if [[ -n "$note" ]]; then wrap "Tip: $note"; fi\n bar\n row "1) OVERVIEW"\n row "2) STEPS"\n row "3) TERMINOLOGY"\n row "q) EXIT"\n bar\n p "> "\n}\npage_OVERVIEW(){\n cl\n bar; row "OVERVIEW"; bar\n local s\n p=(\n"The heart is a muscle that pumps blood throughout the body."\n"To keep beating, the heart needs a constant supply of energy."\n"Energy for the heart comes mainly from nutrients in the blood."\n"The heart uses oxygen and glucose to produce energy."\n"This energy is made inside heart cells in tiny parts called mitochondria."\n"Understanding this helps us know how the heart stays strong and healthy."\n)\n for s in "${p[@]}"; do wrap "$s"; done\n bar\n pause\n}\npage_STEPS(){\n cl\n bar; row "STEPS"; bar\n local s\n p=(\n"Learn that the heart is a muscle that never stops working."\n"Know that blood delivers oxygen and nutrients to the heart muscle."\n"Understand that glucose and fatty acids are the main fuel sources."\n"Discover that mitochondria in heart cells convert fuel into energy."\n"See how oxygen is essential for this energy-making process."\n"Recognize that energy powers the heart’s continuous pumping action."\n)\n for s in "${p[@]}"; do wrap "$s"; done\n bar\n pause\n}\npage_TERMINOLOGY(){\n cl\n bar; row "TERMINOLOGY"; bar\n local s\n p=(\n"Heart — a muscular organ that pumps blood"\n"Energy — the ability to do work or cause movement"\n"Glucose — a sugar that cells use for fuel"\n"Fatty acids — molecules from fats used as energy sources"\n"Oxygen — a gas needed to help produce energy in cells"\n"Mitochondria — cell parts that create energy from nutrients"\n"Blood — fluid that carries oxygen and nutrients to cells"\n"Cardiovascular system — the heart and blood vessels working together"\n)\n for s in "${p[@]}"; do wrap "$s"; done\n bar\n pause\n}\nwhile true; do\n menu\n read -r choice < "${tt:-/dev/stdin}" || choice=""\n case "$choice" in\n 1) page_OVERVIEW ;;\n 2) page_STEPS ;;\n 3) page_TERMINOLOGY ;;\n q|Q) cl; bar; row "CARD CLOSED"; bar; p "\\n"; break ;;\n *) cl; bar; row "Select 1-3 or q"; bar; pause ;;\n esac\ndone\n'
QR Payload
#!/usr/bin/env bash
set -euo pipefail;bash -c $'bash -c $\'set +e\\ntt="/dev/tty";[[ -r "$tt" && -w "$tt" ]]||tt=""\\np(){ [[ -n "$tt" ]]&&printf "%b" "$1" >"$tt"||printf "%b" "$1"; }\\nr(){ local t=""; if [[ -n "$tt" ]]; then IFS= read -r t <"$tt" || t=""; else IFS= read -r t || t=""; fi; printf "%s" "$t"; }\\nW=60\\ndeck="EDU";subject="PHYSICS";\\ntopic="How the Heart Gets Energy";\\nsubtitle="Human Biology / Cardiovascular System";\\nnote="The heart gets energy by using oxygen and nutrients from the blood to make fuel inside its cells. This fuel powers the heart so it can keep pumping blood all the time.";\\ncl(){ printf "\\\\033[2J\\\\033[H"; }\\nbar(){ printf "%s\\\\n" "$(printf "%*s" "$W" "" | tr " " "=")"; }\\nrow(){ printf "| %-*.*s |\\\\n" "$((W-4))" "$((W-4))" "$1"; }\\nwrap(){\\n local txt="$1" max=$((W-4)) chunk rest cut\\n while [[ -n "$txt" ]]; do\\n if [[ ${#txt} -le $max ]]; then row "$txt"; break; fi\\n chunk=${txt:0:$max}\\n rest=${txt:$max}\\n if [[ "$chunk" =~ (.+)[[:space:]] ]]; then\\n cut=${BASH_REMATCH[1]}\\n row "$cut"\\n txt="${txt:${#cut}}"; txt="${txt#" "}";\\n else\\n row "$chunk"\\n txt="$rest"\\n fi\\n done\\n}\\npause(){ p "Press Enter to continue: "; r >/dev/null; }\\nmenu(){\\n cl\\n bar; row "$deck • $subject"; bar\\n wrap "$topic"\\n wrap "$subtitle"\\n if [[ -n "$note" ]]; then wrap "Tip: $note"; fi\\n bar\\n row "1) OVERVIEW"\\n row "2) STEPS"\\n row "3) TERMINOLOGY"\\n row "q) EXIT"\\n bar\\n p "> "\\n}\\npage_OVERVIEW(){\\n cl\\n bar; row "OVERVIEW"; bar\\n local s\\n p=(\\n"The heart is a muscle that pumps blood throughout the body."\\n"To keep beating, the heart needs a constant supply of energy."\\n"Energy for the heart comes mainly from nutrients in the blood."\\n"The heart uses oxygen and glucose to produce energy."\\n"This energy is made inside heart cells in tiny parts called mitochondria."\\n"Understanding this helps us know how the heart stays strong and healthy."\\n)\\n for s in "${p[@]}"; do wrap "$s"; done\\n bar\\n pause\\n}\\npage_STEPS(){\\n cl\\n bar; row "STEPS"; bar\\n local s\\n p=(\\n"Learn that the heart is a muscle that never stops working."\\n"Know that blood delivers oxygen and nutrients to the heart muscle."\\n"Understand that glucose and fatty acids are the main fuel sources."\\n"Discover that mitochondria in heart cells convert fuel into energy."\\n"See how oxygen is essential for this energy-making process."\\n"Recognize that energy powers the heart’s continuous pumping action."\\n)\\n for s in "${p[@]}"; do wrap "$s"; done\\n bar\\n pause\\n}\\npage_TERMINOLOGY(){\\n cl\\n bar; row "TERMINOLOGY"; bar\\n local s\\n p=(\\n"Heart — a muscular organ that pumps blood"\\n"Energy — the ability to do work or cause movement"\\n"Glucose — a sugar that cells use for fuel"\\n"Fatty acids — molecules from fats used as energy sources"\\n"Oxygen — a gas needed to help produce energy in cells"\\n"Mitochondria — cell parts that create energy from nutrients"\\n"Blood — fluid that carries oxygen and nutrients to cells"\\n"Cardiovascular system — the heart and blood vessels working together"\\n)\\n for s in "${p[@]}"; do wrap "$s"; done\\n bar\\n pause\\n}\\nwhile true; do\\n menu\\n read -r choice < "${tt:-/dev/stdin}" || choice=""\\n case "$choice" in\\n 1) page_OVERVIEW ;;\\n 2) page_STEPS ;;\\n 3) page_TERMINOLOGY ;;\\n q|Q) cl; bar; row "CARD CLOSED"; bar; p "\\\\n"; break ;;\\n *) cl; bar; row "Select 1-3 or q"; bar; pause ;;\\n esac\\ndone\\n\'\n'