diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index cbac569..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "deno.enable": true -} diff --git a/cc-tweaked/host.ts b/cc-tweaked/host.ts deleted file mode 100755 index 4f146ca..0000000 --- a/cc-tweaked/host.ts +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/env -S deno run --allow-read --allow-net - -async function main() { - const [program_path] = Deno.args; - if (program_path === undefined) fail_with("Usage: host.ts "); - const port = 1728; - const server = Deno.listen({ port }); - console.log("listening on port", port); - for await (const connection of server) handle(connection, program_path); -} - -async function handle(connection: Deno.TcpConn, program_path: string) { - console.log("serving"); - const file = await try_else( - () => Deno.open(program_path, { read: true }), - () => fail_with("Program at", program_path, "does not exists"), - ); - await try_(() => file.readable.pipeTo(connection.writable)); -} - -function fail_with(...message: string[]) { - console.error(...message); - return Deno.exit(1); -} - -async function try_else(operation: () => T | Promise, on_error: (error: unknown) => T | Promise) { - try { - return await operation(); - } catch (error) { - return await on_error(error); - } -} - -async function try_(operation: () => T | Promise) { - return await try_else(operation, () => null); -} - -if (import.meta.main) await main(); diff --git a/cc-tweaked/scripts/cat.lua b/cc-tweaked/scripts/cat.lua deleted file mode 100644 index d92e5af..0000000 --- a/cc-tweaked/scripts/cat.lua +++ /dev/null @@ -1,8 +0,0 @@ -local arg1, arg2, arg3 = ... - -local function main() - print("arg1", arg1, "arg2", arg2, "arg3", arg3) - local file = fs.open() -end - -main() diff --git a/deno.json b/deno.json deleted file mode 100644 index 92b61b1..0000000 --- a/deno.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "fmt": { - "useTabs": true, - "lineWidth": 120 - } -}