From 46d60df1ecf2e091b0f70f550d605431ec1ef991 Mon Sep 17 00:00:00 2001 From: 20kdc Date: Fri, 8 Jun 2018 16:26:29 +0100 Subject: [PATCH] app-pclogix-upload and app-rsctrl Yes, I made sure to ask Mimiru about permission to target the uploader there. --- repository/apps/app-pclogix-upload.lua | 36 +++++++++++ repository/apps/app-rsctrl.lua | 62 +++++++++++++++++++ repository/data/app-claw/local.lua | 34 ++++++++++ .../docs/repoauthors/app-pclogix-upload | 2 + repository/docs/repoauthors/app-rsctrl | 2 + 5 files changed, 136 insertions(+) create mode 100644 repository/apps/app-pclogix-upload.lua create mode 100644 repository/apps/app-rsctrl.lua create mode 100644 repository/docs/repoauthors/app-pclogix-upload create mode 100644 repository/docs/repoauthors/app-rsctrl diff --git a/repository/apps/app-pclogix-upload.lua b/repository/apps/app-pclogix-upload.lua new file mode 100644 index 0000000..e039631 --- /dev/null +++ b/repository/apps/app-pclogix-upload.lua @@ -0,0 +1,36 @@ +-- This is released into the public domain. +-- No warranty is provided, implied or otherwise. +-- app-pclogix-upload: Upload to PCLogix Hastebin (paste.pc-logix.com) +local inet = neo.requireAccess("c.internet", "to upload").list()() +assert(inet, "no internet card") +local event = require("event")(neo) +local neoux = require("neoux")(event, neo) + +local f = neoux.fileDialog(false) +if not f then return end +local data = f.read("*a") +f.close() + +local s = inet.request("http://paste.pc-logix.com/documents", data) +assert(s, "no socket") +s.finishConnect() +local code, msg = s.response() +local res = tostring(code) .. " " .. tostring(msg) .. "\n" +while true do + local chk, err = s.read(neo.readBufSize) + if not chk then + res = res .. "\n" .. tostring(err) + break + end + if chk == "" then + event.sleepTo(os.uptime() + 0.05) + else + res = res .. chk + end +end +res = res .. "\nPrefix ID with http://paste.pc-logix.com/raw/" +neoux.startDialog(res, "result", true) +s.close() +-- that's a hastebin client for OC! +-- done! now I'll upload this with itself. +-- - 20kdc \ No newline at end of file diff --git a/repository/apps/app-rsctrl.lua b/repository/apps/app-rsctrl.lua new file mode 100644 index 0000000..e890d78 --- /dev/null +++ b/repository/apps/app-rsctrl.lua @@ -0,0 +1,62 @@ +-- This is released into the public domain. +-- No warranty is provided, implied or otherwise. + +-- app-rsctrl: redstone control + +local event = require("event")(neo) +local neoux = require("neoux")(event, neo) +local rs = neo.requireAccess("c.redstone", "redstone control") +neo.requireAccess("s.h.redstone_changed", "updating to new input") +local running = true +local window +--123456789012345678901234567890123456789012345 +--PPPPPPPP-PPPP-PPPP-PPPPPPPPPPPP Wake=[x] +-- D=y[x] U=y[x] N=y[x] S=y[x] W=y[x] E=y[x] +local function mainGen() + local ctrls = {} + local prs = 0 + for pri in rs.list() do + prs = prs + 1 + local ins = {} + local outs = {} + local wt = pri.getWakeThreshold() + for i = 0, 5 do + ins[i + 1] = pri.getInput(i) + outs[i + 1] = pri.getOutput(i) + end + table.insert(ctrls, neoux.tcrawview(1, (prs * 2) - 1, { + unicode.safeTextFormat(pri.address), + string.format(" D=%01x U=%01x N=%01x S=%01x W=%01x E=%01x", table.unpack(ins)) + })) + table.insert(ctrls, neoux.tcrawview(38, (prs * 2) - 1, { + "Wake=" + })) + table.insert(ctrls, neoux.tcfield(43, (prs * 2) - 1, 3, function (tx) + if tx then + wt = math.floor(tonumber("0x" .. tx:sub(-1)) or 0) + pri.setWakeThreshold(wt) + end + return string.format("%01x", wt) + end)) + for i = 0, 5 do + table.insert(ctrls, neoux.tcfield(6 + (i * 7), prs * 2, 3, function (tx) + if tx then + outs[i + 1] = tonumber("0x" .. tx:sub(-1)) or 0 + pri.setOutput(i, outs[i + 1]) + end + return string.format("%01x", outs[i + 1]) + end)) + end + end + return 45, prs * 2, nil, neoux.tcwindow(45, prs * 2, ctrls, function () + window.close() + running = false + end, 0xFFFFFF, 0) +end +window = neoux.create(mainGen()) +while running do + local hv = event.pull() + if hv == "redstone_changed" then + window.reset(mainGen()) + end +end \ No newline at end of file diff --git a/repository/data/app-claw/local.lua b/repository/data/app-claw/local.lua index 81c0278..f44920e 100644 --- a/repository/data/app-claw/local.lua +++ b/repository/data/app-claw/local.lua @@ -130,6 +130,40 @@ return { "data/app-metamachine/lucaboot.lua" }, }, + ["app-pclogix-upload"] = { + desc = "paste.pc-logix.com text uploader", + v = 0, + deps = { + "neo", + "zzz-license-pd" + }, + dirs = { + "apps", + "docs", + "docs/repoauthors" + }, + files = { + "apps/app-pclogix-upload.lua", + "docs/repoauthors/app-pclogix-upload" + }, + }, + ["app-rsctrl"] = { + desc = "Redstone control", + v = 0, + deps = { + "neo", + "zzz-license-pd" + }, + dirs = { + "apps", + "docs", + "docs/repoauthors" + }, + files = { + "apps/app-rsctrl.lua", + "docs/repoauthors/app-rsctrl" + }, + }, ["app-launchbar"] = { desc = "Application launcher bar", v = 0, diff --git a/repository/docs/repoauthors/app-pclogix-upload b/repository/docs/repoauthors/app-pclogix-upload new file mode 100644 index 0000000..6610380 --- /dev/null +++ b/repository/docs/repoauthors/app-pclogix-upload @@ -0,0 +1,2 @@ +repository/apps/app-pclogix-upload.lua: 20kdc, Public Domain + diff --git a/repository/docs/repoauthors/app-rsctrl b/repository/docs/repoauthors/app-rsctrl new file mode 100644 index 0000000..95e1132 --- /dev/null +++ b/repository/docs/repoauthors/app-rsctrl @@ -0,0 +1,2 @@ +repository/apps/app-rsctrl.lua: 20kdc, Public Domain +