Skip to content

Instantly share code, notes, and snippets.

@Fingercomp
Fingercomp / eta.lua
Last active December 18, 2016 14:22
local scale = 0.75
local avgs = {}
local function calcAvg(last)
if #avgs == 0 then
table.insert(avgs, last)
return last
end
local len = #avgs
local sum = 0
local UlikV=load([===[
local rA5U=20160728.17
local Uc06="-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20160728.17 ]-"local lcBL={VERSION=rA5U,AUTHOR_NOTE=Uc06}local DHPxI=" "
local dx={pretty=true,align_keys=false,indent=DHPxI}
local RRuSHnxf={__tostring=function()return"JSON array"end}RRuSHnxf.__index=RRuSHnxf
local mcYOuT={__tostring=function()return"JSON object"end}mcYOuT.__index=mcYOuT;function lcBL:newArray(iXxD6s)
return setmetatable(iXxD6s or{},RRuSHnxf)end;function lcBL:newObject(oiY)return
setmetatable(oiY or{},mcYOuT)end;local function Rr(FsYIVlkf)
return
local shell = require("shell")
local fs = require("filesystem")
local args = {...}
local elog = shell.resolve(table.remove(args, 1))
local path = shell.resolve(table.remove(args, 1))
if not elog or not path then
print("USAGE: crash <error log path> <path to program> [arguments...]")
return 1
@Fingercomp
Fingercomp / https-oc-compat.lua
Created August 16, 2016 16:22
Luascket's https ⟷ OC http libraries compatibility layer
local ltn12 = require("ltn12")
local http = require("http")
local https = {
request = function(params)
local body = nil
if params.source then
body = ""
for chunk in params.source do
body = body .. chunk
Certificate = SEQUENCE {
tbsCertificate = TBSCertificate = SEQUENCE {
version = EXPLICIT (Version = INTEGER {v1(0), v2(0), v3(2)}) DEFAULT v1,
serialNumber = CertificateSerialNumber = INTEGER,
signature = AlgorithmIdentifier = SEQUENCE {
algorithm = OBJECT IDENTIFIER,
parameters = ANY DEFINED BY algorithm OPTIONAL
},
issuer = Name = CHOICE {
-- only one possibility for now --
2.999 G / 2.999 G▕ ▏ 0.00% -- 10.00 k/s 02:50:00
9999 B / 9999 B▕██████████ ▏ 50.00% -- 10.00 k/s 00:59:59
10.00 k / 10.00 k▕██████████▏ ▏ 50.12% -- 10.00 k/s 55:59
99.99 k / 99.99 k▕██████████▎ ▏ 50.25% -- 99.99 k/s 10:00
100.0 k / 100.0 k▕██████████▍ ▏ 50.37% -- 100.0 k/s 09:59
999.9 k / 999.9 k▕██████████▌ ▏ 50.50% -- 999.9 k/s 01:30
1.000 G / 1.000 M▕██████████▋ ▏ 50.62% -- 1.000 G/s 00:05
9.999 G / 9.999 M▕██████████▊ ▏ 50.75% -- 9.999 G/s 00:00
10.00 G / 10.00 G▕██████████▉ ▏ 50.87% -- 10.00 G/s 2d, 22:22:22
99.99 G / 99.99 G▕███████████ ▏ 51.00% -- 99.99 G/s 9999d, 11:11:11
@Fingercomp
Fingercomp / nn.lua
Last active September 8, 2022 21:01
OpenComputers Nanomachines control program [Minecraft]
local CONF = "/etc/nn.conf"
local m = require("component").modem
local event = require("event")
local ser = require("serialization")
local fs = require("filesystem")
local unicode = require("unicode")
_G.port = _G.port or 27091
_G.max = _G.max or 15
_G.effects = _G.effects or {}
@Fingercomp
Fingercomp / lamp.lua
Created November 12, 2015 18:21
Lamp-o-mat. Controls CX lamps using OC computer [Minecraft]
-- Lamp-o-mat. Controls CX lamps using OC computer. Minecraft. --
global_lamps = {"cf0", "95c", "ad9", "a1a", "d97", "afb", "cc5", "335", "a75"}
global_exit = false
local com = require("component")
local event = require("event")
base = {__index = base}
function base.__call(self, count)
if not global_exit then
count = count or math.huge