1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-11-23 10:58:06 +11:00

app-pclogix-upload and app-rsctrl

Yes, I made sure to ask Mimiru about permission to target the uploader there.
This commit is contained in:
20kdc 2018-06-08 16:26:29 +01:00
parent ae89024112
commit 46d60df1ec
5 changed files with 136 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -130,6 +130,40 @@ return {
"data/app-metamachine/lucaboot.lua" "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"] = { ["app-launchbar"] = {
desc = "Application launcher bar", desc = "Application launcher bar",
v = 0, v = 0,

View File

@ -0,0 +1,2 @@
repository/apps/app-pclogix-upload.lua: 20kdc, Public Domain

View File

@ -0,0 +1,2 @@
repository/apps/app-rsctrl.lua: 20kdc, Public Domain