Skip to content

Instantly share code, notes, and snippets.

@christopher-dG
Created January 21, 2025 19:17
Show Gist options
  • Select an option

  • Save christopher-dG/938d3e71a348fe6653597934761fe253 to your computer and use it in GitHub Desktop.

Select an option

Save christopher-dG/938d3e71a348fe6653597934761fe253 to your computer and use it in GitHub Desktop.
import subprocess
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def cowsay():
stdin = request.args.get("quote", "").encode("utf-8")
proc = subprocess.run(["cowsay"], input=stdin, capture_output=True)
return proc.stdout.decode()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment