Skip to content

Instantly share code, notes, and snippets.

@Zizazar
Zizazar / GUI.lua
Created November 11, 2025 20:08
ECS GUI lib
require("advancedLua")
local component = require("component")
local computer = require("computer")
local keyboard = require("keyboard")
local filesystem = require("filesystem")
local unicode = require("unicode")
local event = require("event")
local color = require("color")
--local image = require("image")
local buffer = require("doubleBuffering")
op = component.openprinter
if not op then
error("No open printer found")
end
function pg(title)
op.setTitle(title)
print("next page")
op.print()
end
@Zizazar
Zizazar / BaseOverlay.cs
Created June 8, 2025 06:13
Unity self registred ui screen/overlay controller
public abstract class BaseOverlay : MonoBehaviour
{
public bool IsActive => gameObject.activeSelf;
public virtual void Show()
{
gameObject.SetActive(true);
}
public virtual void Hide()
@Zizazar
Zizazar / ListExtensions.cs
Created June 2, 2025 09:03
Useful metods for Unity List
using System;
using System.Collections.Generic;
using UnityEngine;
public static class ListExtensions
{
public static T GetRandom<T>(this IList<T> list, bool ignoreEmpty = true)
{
if (list == null || list.Count == 0)
{
# Small script that converts one track of midi to Scrap Computers HDD array.
import mido
import json
mid = mido.MidiFile('bad_apple.mid')
converted = []
for msg in mid.tracks[0]:
if not msg.is_meta and msg.type in ('note_on', 'note_off'):