Skip to content

Instantly share code, notes, and snippets.

@Corecii
Corecii / formatting.md
Last active May 20, 2022 04:42
Steam Deck SD Card formatting

How to format micro SD card for Steam Deck manually

The Steam Deck seems to cause irreparable issues when it formats an SD card twice.

In hopes of avoiding those issues, I'va manually formatted the SD card. I haven't confirmed if this avoids the "issues when formatted twice" because that would mean potentially breaking the expensive SD card!

Steps

@Corecii
Corecii / README.md
Last active September 22, 2024 16:28
Sample GitHub Actions file for running Roblox tests while connected to a WireGuard server

Sample Roblox Tests with WireGuard GitHub Actions File

Roblox changed their login behavior such that login cookies are tied to IP address. This prevents Roblox from working will with GitHub actions, as GitHub actions runners don't always use the same IP.

This action file connects to a WireGuard server first such that the action runner's IP appears to be the WireGuard server's. You can connect to the WireGuard server yourself to generate a login cookie so that the login IP is consistent between the original login and the action runners.

Server Setup

@Corecii
Corecii / idea_methods_with_self.lua
Created February 17, 2021 03:35
Promise- and callback-heavy code relies on passing objects around a lot, and having to enclose objects in callbacks is annoying. What if we could *almost* do `object:method` to reference a version of the method that includes the object?
local withMeta = {}
function withMeta:__index(key)
local object = self._with
return function(...)
return object[key](object, ...)
end
end
local function with(object)
@Corecii
Corecii / OnDestroyed.lua
Last active August 30, 2020 18:18
Roblox Instance Destroyed and Garbage Collected Example Code
--[[
Notable behavior:
* ObjectValues will get their Value set to nil if:
* The ObjectValue is in nil
* its Value is in nil
* its Value gets garbage collected because it has no string reference
* When an object gets garbage collected, all of its connections get disconnected.
* Connections that don't hold a reference to the object won't prevent garbage collection!!
* When an object gets destroyed, connections are disconnected by the next Heartbeat
@Corecii
Corecii / TryCatchExample.lua
Created May 21, 2020 22:05
Roblox TS Try/Catch/Finally Example
-- Compiled with roblox-ts v0.4.0
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local function example()
while true do
local _0, _1 = TS.try(function()
return TS.TRY_RETURN, {}
end, function(err)
return TS.TRY_CONTINUE
end, function()
return TS.TRY_BREAK
@Corecii
Corecii / luajit_lanes_reuse.lua
Last active May 17, 2018 19:02
Untested example code for reusing lanes in luajit to bypass thread creation time
local retired_lanes = {}
local function thread_func(controller)
while true do
local key, func_args = controller:receive(10, "func_args")
if key == lanes.cancel_error then
break
end
if func_args then
@Corecii
Corecii / PlacePlugins.lua
Last active February 13, 2018 05:19
PlacePlugins Original Source Code
local placePlugins = game:GetService('ServerStorage'):WaitForChild('PlacePlugins', math.huge)
local loaded = {}
local function loadPlugin(name, pluginBase)
local newPlugin = PluginManager():CreatePlugin()
newPlugin.Name = name
if typeof(pluginBase) == "Instance" then
pluginBase.Parent = newPlugin
else
@Corecii
Corecii / tpcall.lua
Last active February 24, 2024 20:44
Pcall with traceback for Roblox
--[[
Use:
On success:
local success, return1, return2, ... = tpcall(func, arg1, arg2, ...)
On error:
local success, error, traceback = tpcall(func, arg1, arg2, ...)
--]]
--[[ runner.lua: belongs inside tpcall.lua
return setmetatable({}, {
@Corecii
Corecii / UnityKeyCodes.txt
Created October 19, 2017 16:14
Unity KeyCode Names
None
Backspace
Delete
Tab
Clear
Return
Pause
Escape
Space
Keypad0
@Corecii
Corecii / Yield.lua
Last active September 18, 2017 07:02
Coroutine-like scheduler-friendly interface for Roblox Lua
--[[ API Reference
Class Yield
METHODS
static Yield(f: function) --> yield: Yield
static :new(f: function) --> yield: Yield
Creates a new Yield that will run `f` when resumed
static :running() --> Yield currentYield
Returns the Yield that is currently running, or nil if none.
static :yield(... [1]) --> ... [2]