Skip to content

Instantly share code, notes, and snippets.

@MyNameIsKodos
MyNameIsKodos / derp.lsl
Created August 6, 2017 00:30
Descriptions for Channels
integer ID2Chan( string id )
{
integer mainkey = 921;
string tempkey = llGetSubString( ( string )id, 0, 7 );
integer hex2int = ( integer )( "0x" + tempkey );
return hex2int + mainkey;
}
NETWORK_CHANNEL = ID2Chan( llMD5String( llGetObjectDesc(), 0 ) );
listenhandle = llListen( NETWORK_CHANNEL, "", "", "" );
@MyNameIsKodos
MyNameIsKodos / veinTracker.lua
Created September 19, 2016 23:58 — forked from MalkContent/veinTracker.lua
OpenComputers program to keep track of ImmersiveEngineering Mineral Deposits
local term = require("term")
local gpu = term.gpu()
local seri = require("serialization")
local p_set = "^set%s+(-?%d+)%s+(-?%d+)%s+(%d+)$"
local p_setStr = "^set%s+(-?%d+)%s+(-?%d+)%s+([%a%s]+)$"
local p_get = "^get%s+(-?%d+)%s+(-?%d+)$"
local p_quit = "^quit$"
local p_save = "^save$"
local p_load = "^load$"
local component = require("component")
local shell = require("shell")
local timeapi = require("timeapi")
local op = component.openprinter
local args, options = shell.parse(...)
local player = options.player
local amt = options.amount
@MyNameIsKodos
MyNameIsKodos / client.lua
Last active September 20, 2015 07:28
Basic Drone control program
local component = require("component")
local event = require("event")
local m = component.modem
local args, options = shell.parse(...)
function testSend(a,b,c)
component.modem.broadcast(a,b,c)
local _,_,from,port,_,message = event.pull("modem_message")
return from,message
import net.minecraft.world.{IBlockAccess, World}
@Override
public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side)
{
return true;
}
@MyNameIsKodos
MyNameIsKodos / kodoslib.lua
Created February 14, 2015 02:22
Random stuff lib
function str2hex(a) return a:gsub(".",function(a) return string.format("%02x",a:byte()) end) end
function hex2str(a) return a:gsub("..",function(a) return string.char(tonumber(a,16)) end) end
for i = 0,115 do print(i .. " + " .. 115 - i .. " = 115") end
local component = require("component")
local os = require("os")
local term = require("term")
local gpu = component.gpu
local lamp = component.colorful_lamp -- As of right now, a Computronics Lamp is required.
-- I may take another stab at making it optional later on,
-- but for now, it's required or the program will not run.
orange = 25984
yellow = 32736
@MyNameIsKodos
MyNameIsKodos / kodosmath.lua
Last active August 29, 2015 14:13
Lua Math Lib by Kodos
function round(num, idp) local mult = 10^(idp or 0) return math.floor(num * mult + 0.5) / mult end
@MyNameIsKodos
MyNameIsKodos / kodoscolors.lua
Last active August 29, 2015 14:12
RGB (0-31) to 15 bit (For use with Colorful Lamps)
function rgbto15(r,g,b) return (b%32)+((g%32)*32)+((r%32)*1024) end
function rgbToHex(r,g,b) return string.format("0x%02X%02X%02X",r,g,b) end
function hexToRGB(a) a=tonumber(a) return math.floor(a/65536)%256,math.floor(a/256)%256,a%256 end