GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — deckmill/generate_habits_carousel.py at master · ishan-parihar/deckmill Expand file tree/ Copy pathgenerate_habits_carousel.pyMore file actions executable file ·150 lines (136 loc) · 5.63 KB / Copy pathgenerate_habits_carousel.pyFile metadata and controlsexecutable file ·150 lines (136 loc) · 5.63 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 #!/usr/bin/env python3 import os import json import subprocess # Define configuration paths WORKSPACE_DIR = "/home/ishanp/Documents/GitHub/MY-PROJECTS/MCP-AND-CLIS/deckmill" TOKENS_FILE = os.path.join(WORKSPACE_DIR, "design_tokens.json") SLIDES_JSON_FILE = os.path.join(WORKSPACE_DIR, "habits_slides.json") OUTPUT_HTML_FILE = os.path.join(WORKSPACE_DIR, "dist", "habits_carousel.html") # Create dist directory if it doesn't exist os.makedirs(os.path.dirname(OUTPUT_HTML_FILE), exist_ok=True) # Binary path (using target/debug/deckmill built earlier) DECKMILL_BIN = os.path.join(WORKSPACE_DIR, "target/debug/deckmill") def run_cmd(args): print(f"Running command: {' '.join(args)}") result = subprocess.run(args, capture_output=True, text=True, cwd=WORKSPACE_DIR) if result.returncode != 0: print(f"Error executing command: {result.stderr}") raise RuntimeError(result.stderr) return result.stdout def main(): # 1. Configure design with #00FFCC # Using technical style (Space Grotesk) and vibrant preset for professional neon accent feel run_cmd([ DECKMILL_BIN, "configure-design", "#00FFCC", "--style", "technical", "--preset", "vibrant", "--output", TOKENS_FILE ]) # 2. Define parameters for all 5 slides slides_definition = [ # Slide 1: Hero Hook { "type": "hero", "theme": "dark", "bg_style": "dark", "params": { "headline": "3 Habits of Exceptional Developers", "subheadline": "Write cleaner, more maintainable code with these simple daily workflow shifts.", "badge": "CODING HABITS", "variant": "gradient" } }, # Slide 2: Myth vs Fact (Habit 1: Write Simple Code) { "type": "myth_fact", "theme": "dark", "bg_style": "dark", "params": { "myth": "Exceptional developers write complex, clever code.", "fact": "Exceptional developers write simple, readable code.", "explanation": "Clever code is hard to read, debug, and maintain. Always prioritize clarity over cleverness." } }, # Slide 3: Checklist (Habit 2: Boy Scout Rule) { "type": "checklist_action_plan", "theme": "dark", "bg_style": "dark", "params": { "title": "The Boy Scout Rule Checklist", "items": [ {"label": "Rename vague or ambiguous variables"}, {"label": "Break complex conditions into named functions"}, {"label": "Delete dead code and outdated comments"}, {"label": "Write a unit test for the code you changed"} ], "variant": "checklist" } }, # Slide 4: Problem-Solution (Habit 3: Tight Feedback Loops) { "type": "problem_solution", "theme": "dark", "bg_style": "dark", "params": { "title": "Short Feedback Loops", "problem": "Bugs found in production are 100x more expensive to fix.", "solution": "Verify assumptions continuously as you write code.", "proof_points": [ {"title": "Test-Driven Writing", "description": "Write code and tests in small, alternating increments."}, {"title": "Continuous Peer Review", "description": "Share early drafts to catch design issues before they merge."} ], "variant": "split" } }, # Slide 5: Call to Action (Conclusion) { "type": "cta", "theme": "dark", "bg_style": "dark", "params": { "headline": "Start Improving Your Habits Today", "subheadline": "Which of these 3 habits will you focus on first? Share in the comments!", "button_text": "Save & Share", "variant": "centered" } } ] # Generate slides individually generated_slides = [] for idx, slide in enumerate(slides_definition): print(f"Generating slide {idx+1}/{len(slides_definition)} ({slide['type']})...") # Serialize params to JSON string params_str = json.dumps(slide["params"]) stdout = run_cmd([ DECKMILL_BIN, "generate-slide", slide["type"], "--tokens-file", TOKENS_FILE, "--theme", slide["theme"], "--bg-style", slide["bg_style"], "--archetype", "educator", "--params", params_str ]) # Parse output JSON and append to slides list slide_spec = json.loads(stdout) generated_slides.append(slide_spec) # Save slides array to a temporary file with open(SLIDES_JSON_FILE, "w") as f: json.dump(generated_slides, f, indent=2) print(f"Saved slides JSON specs to {SLIDES_JSON_FILE}") # 3. Render full carousel HTML document run_cmd([ DECKMILL_BIN, "render-carousel", SLIDES_JSON_FILE, "--tokens-file", TOKENS_FILE, "--brand-name", "Codecraft Insights", "--brand-handle", "@codecraft", "--topic", "Coding Habits", "--url", "https://codecraft.dev", "--hashtags", "programming,cleancode,webdev,softwareengineering", "--platform", "instagram_portrait", "--aspect-ratio", "4:5", "--output", OUTPUT_HTML_FILE ]) print(f"\nSuccess! Final rendered HTML carousel is saved at:\n{OUTPUT_HTML_FILE}") if __name__ == "__main__": main() |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |