From 7b9971294a4a10c9a525732c55bc0d0966ab5269 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Wed, 6 Apr 2022 09:09:20 -0700 Subject: [PATCH] Add Ty applet --- applets/ty.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 applets/ty.py diff --git a/applets/ty.py b/applets/ty.py new file mode 100755 index 00000000..0f15bd18 --- /dev/null +++ b/applets/ty.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 + +import sys +import subprocess + +url = 'https://based.lol/run.ty' + +if len(sys.argv) <= 1: + print('Usage: ty` [-stdin=]') + sys.exit(0) + +cmd = ' '.join(sys.argv[1:]).replace('\\n', '\n') + +[code, *input] = cmd.split('-stdin=') + +print(subprocess.run(['curl', url, '-F', f'code={code}', '-F', f'input={"".join(input)}'], text=True, capture_output=True).stdout.rstrip())