Skip to content

Instantly share code, notes, and snippets.

View SammyForReal's full-sized avatar
🪤
Mouse Trap!

Sammy SammyForReal

🪤
Mouse Trap!
View GitHub Profile
@SammyForReal
SammyForReal / stats.lua
Created October 6, 2023 21:48
Display vertical progressbars dynamically.
-- Gather peripherals
local mon = peripheral.find("monitor")
-- Create is used as an example here.
local vault = peripheral.find("create:item_vault")
local speedometer = peripheral.find("Create_Speedometer")
local stressometer = peripheral.find("Create_Stressometer")
-- Init
mon.setTextScale(0.5)
@SammyForReal
SammyForReal / manuscript.lua
Created July 31, 2023 01:50
Make turtles run with certain instructions seamingless and savely as intended!
local coal_slot = 16
local wait_delay = 30 -- In seconds
local start = { -154, 69, 74 }
--[[ Instruction set:
- Move: { <dir>, <steps> }
- dir = "north", "east", "south", "west", "y"
- steps = how many steps it should go, e.g: 3
- Placing: { "place", <side>, <slot> }
- side = "left" or "right"
- slot = 1 to 16
@SammyForReal
SammyForReal / log4l.lua
Last active October 8, 2023 01:28
A small enhanced logging module for Lua.
--- log4l.lua
-- A small enhanced logging module for Lua.
-- @licence MIT
-- @autor Sammy L. Koch (1Turtle)
-- @version 1.2
local wrap = require("cc.strings").wrap
local log4l = {}
local meta = {
@SammyForReal
SammyForReal / post.lua
Created April 8, 2023 15:05
Print .2dja poster easily!
-- By Sammy (1Turtle)
-- Licence: The Unlicence
-- Get poster printer
local poster = peripheral.find("poster_printer")
if not poster then
error("A poster printer is required.")
end
-- Print usage
@SammyForReal
SammyForReal / network-tools.lua
Created April 7, 2023 13:29
Network tools for ComputerCraft (not recommended).
--[[
This is a small api to make wireless messages somewhat secure.
It is not recommended to use this in production as this is just awful. Use something strong.
However, this may be worth a look to understand what kind of steps could be used to secure a system.
]]
local tools = {}
---Gets a "random" number in hex format.
---@return string salt The number as string in hex format.
@SammyForReal
SammyForReal / downloadGitHubRepo.lua
Created March 27, 2023 15:46
download GitHub Repos in CraftOS
--[[
Title: downloadGitHubRepo
Author: Kristify Team
Licence: MIT Licence (for more details: https://mit-license.org/)
Version: 1.0
]]
--Configuration------------------------------------
local bSilent = false
@SammyForReal
SammyForReal / singleGPShost.lua
Created August 14, 2022 17:36
Host GPS with a single PC, instead of 4!
-- Insert name of 'wireless_modems' (attatched to wired_modems), used for GPS here
-- Remove the already existing onces!
-- EXAMPLE: ["modem_0"] = {x=1, y=2, z=3}
local point = {
["modem_0"] = {x=151, y=56, z=-43},
["modem_1"] = {x=156, y=56, z=-43},
["modem_2"] = {x=151, y=56, z=-38},
["modem_3"] = {x=151, y=60, z=-43}
}
local CHANNEL_GPS = gps.CHANNEL_GPS
@SammyForReal
SammyForReal / chromy.lua
Last active July 27, 2022 10:21
Chromy | Render bimg files easily!
--[[
Chromy | A small Bimg API | v.1.6
=================================
Available under the MIT Licence
Copyright (c) 2022 Sammy L. Koch
---------------------------------
Load images or animations in the
unofficial official bimg (blit -
image) format!
@SammyForReal
SammyForReal / coater.lua
Last active July 11, 2022 20:11
Small lua pixel render API, written for ComputerCraft.
--[[
Coater | Pixel render API | v.1.0
=================================
Available under the MIT Licence
Copyright (c) 2022 Sammy L. Koch
]]
local ccExpect = require("cc.expect")
local expect,field,range = ccExpect.expect,ccExpect.field,ccExpect.range
local tCToB = {[1]='0',[2]='1',[4]='2',[8]='3',[16]='4',[32]='5',[64]='6',[128]='7',[256]='8',[512]='9',[1024]='a',[2048]='b',[4096]='c',[8192]='d',[16384]='e',[32768]='f' }