Skip to content

Instantly share code, notes, and snippets.

@fnuecke
fnuecke / SelectionNavigation.cs
Created December 14, 2023 03:19
[Unity] Selection History Navigation
#if UNITY_EDITOR
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using UnityEditor;
using UnityEngine;
/// <summary>
#if UNITY_EDITOR
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Little utility for opening a "Game" view in fullscreen. Will be opened on whatever Unity thinks is the "main"
/// monitor at the moment. The hotkey will toggle the window; however, if for some reason this breaks, fullscreen
local computer = require("computer")
while true do
local maxMem = 0
for i=1,10 do maxMem = math.max(maxMem, computer.freeMemory()) os.sleep(0) end
print(maxMem)
os.sleep(5)
end
--[[ This script automatically saves the global environment periodically
and restores it when this script is run. Recommended usage is with
the standalone Lua interpreter like this:
lua -i autosave.lua
It was coded for and tested with Eris (https://github.com/fnuecke/eris).
This approach is quite limited and could be improved in a number of ways:
- Userdata cannot be persisted automatically, so if, for example, some
@fnuecke
fnuecke / bios.lua
Created December 24, 2014 00:35
Primitive remote code execution via OC network
local m=component.proxy(component.list("modem")())
m.open(2412)
local function respond(...)
local args=table.pack(...)
pcall(function() m.broadcast(2412, table.unpack(args)) end)
end
local function receive()
while true do
local evt,_,_,_,_,cmd=computer.pullSignal()
if evt=="modem_message" then return load(cmd) end
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000
@fnuecke
fnuecke / me-level.lua
Created November 30, 2014 15:15
AE utils for OC
local component = require("component")
local controller = component.appeng_blocks_controller
local modem = component.modem
local items = dofile("/me/items.dat")
local config = dofile("/me/level.cfg")
local function sendRequest(color, count)
modem.broadcast(45555, color, count)
end
--[[ This software is licensed under the M.I.T. license.
Author: David Bergman
Source: https://code.google.com/p/lualisp/
This is a Scheme/Lisp interpreter, written in Lua.
Adjusted for Lua 5.2 and amalgamated for OpenComputers.
Run it without parameters to get into interpreter mode.
Alternatively pass it a file name of a lisp script.
]]

Keybase proof

I hereby claim:

  • I am fnuecke on github.
  • I am fnuecke (https://keybase.io/fnuecke) on keybase.
  • I have a public key whose fingerprint is 8CAD 5DE5 0517 4D2F FF35 907B F8ED 74FB E43A 0800

To claim this, I am signing this object:

@fnuecke
fnuecke / lisp.lua
Created December 30, 2013 14:48
https://code.google.com/p/lualisp/ amalgamated and ported for Lua 5.2 and adjusted to run in OpenComputers (meaning it uses some OpenComputers specific functions)
-- This software is licensed under the M.I.T. license.
-- Author: David Bergman
--
-- This is a Scheme/Lisp interpreter, written in Lua.
-- Adjusted for Lua 5.2 and amalgamated for OpenComputers.
-- Run it without parameters to get into interpreter mode.
-- Alternatively pass it a file name of a lisp script.
local environment = {}