Added random stuff I had laying around

This commit is contained in:
Casey 2023-10-17 19:10:09 +03:00
parent 5b261e82c2
commit e780d7017e
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
4 changed files with 78 additions and 0 deletions

17
ccshow.lua Normal file
View File

@ -0,0 +1,17 @@
local ccpi = require("ccpi")
local args = { ... }
local terminal = term.current()
if args[1] == "-m" then
table.remove(args, 1)
terminal = peripheral.wrap(table.remove(args, 1))
end
local img, err = ccpi.load(args[1])
if not img then
printError(err)
return
end
terminal.clear()
ccpi.draw(img, 1, 1, terminal)

21
custom-colors.lua Normal file
View File

@ -0,0 +1,21 @@
local customColors = {
[colors.white] = 0xEFEFEF,
[colors.orange] = 0xD99F82,
[colors.magenta] = 0x464A73,
[colors.lightBlue] = 0xA1D5E6,
[colors.yellow] = 0xE6CCA1,
[colors.lime] = 0x86BF8F,
[colors.pink] = 0xC98F8F,
[colors.gray] = 0x515151,
[colors.lightGray] = 0xA3A3A3,
[colors.cyan] = 0xC2F2F2,
[colors.blue] = 0x6699CC,
[colors.brown] = 0x735F4B,
[colors.green] = 0x6DA18A,
[colors.red] = 0xBD555F,
[colors.black] = 0x131313
}
for id, color in pairs(customColors) do
term.setPaletteColor(id, color)
end

BIN
n25.cpi Normal file

Binary file not shown.

40
runonchange.lua Normal file
View File

@ -0,0 +1,40 @@
local args = { ... }
local modtimes = {}
if #args == 0 then
print("usage: runonchange [files to watch ...] -- program [args...]")
return
end
while #args > 0 do
local name = table.remove(args, 1)
if name == "--" then break end
modtimes[name] = -1
end
if #args == 0 then
printError("No executable was given")
return
end
while true do
local shall_run = false
for name, modtime in pairs(modtimes) do
local modtime_new = fs.attributes(name).modified
if modtime_new ~= modtime then
shall_run = true
modtimes[name] = modtime_new
print(name .. " was modified")
end
end
if shall_run then
local succ, err = pcall(shell.run, table.unpack(args))
if succ then
print("Process finished successfully")
else
printError("Process crashed: " .. err)
end
end
os.sleep(0.5)
end