Skip to content

Instantly share code, notes, and snippets.

@Anaminus
Anaminus / BBFL.md
Last active July 27, 2020 19:09
Basic Binary Format Language

Basic Binary Format Language

BBFL is a loosely-defined language for describing the content of binary files. The intention is to be unambiguous enough for a human to understand how a file is structured.

Units

This document uses the following units:

  • bit: A unit of information; 0 or 1.
  • byte: The smallest addressable unit of information. usually defined as 8
@Anaminus
Anaminus / iterable.lua
Created July 1, 2020 23:39
Make a table an iterable array.
local t = {'a', 'b', 'c', 'd'}
setmetatable(t, {
__call = function(t, _, i)
if i == nil then
i = 1
else
i = i + 1
end
local v = t[i]
if v == nil then
@Anaminus
Anaminus / module-template.lua
Created June 22, 2020 14:31
Template for formatting ModuleScript descriptions.
--[[
ModuleName
A short description of the module.
SYNOPSIS
-- Lua code that showcases an overview of the API.
local foobar = ModuleName.TopLevel("foo")
print(foobar.Thing)
@Anaminus
Anaminus / MaterialColors-format.md
Created January 15, 2020 21:39
Description of the Terrain.MaterialColors binary format

MaterialColors

The format of the MaterialColors property is an array of colors. Each group of 3 bytes represents a Color3 corresponding to a particular Material enum item. The 3 bytes in each group correspond to the R, G, and B components of the Color3.

The array corresponds to a predetermined, constant list of materials. The first two groups appear to always be zeroed. It is possible these are reserved for the Air and Water materials.

RR GG BB

--[[ Scheduler
A custom scheduler for managing threads.
SYNOPSIS
New(): Scheduler
Drivers: Dictionary[string]Driver
Drivers.Heartbeat: Driver
Drivers.ContinuousHeartbeat: Driver
@Anaminus
Anaminus / attributes-format.txt
Created October 29, 2019 21:53
Description of Roblox attributes binary format.
#endian:little
main Dictionary
type Value struct {
Type uint:8
if .Type == 00 {}
if .Type == 01 {}
if .Type == 02 {Value String}
if .Type == 03 {Value Bool}
@Anaminus
Anaminus / autocomplete.txt
Created October 17, 2019 20:03
Descriptions generated from autocomplete.
library core
func getmetatable(table: table): dictionary
Returns the metatable of the specified object if it has one, otherwise
returns nil. If the object does have a metatable, but the metatable has
a __metatable field set, the value of __metatable will be returned
instead.
func setmetatable(table: table, metatable: table?): dictionary
Sets the metatable for the given table. If metatable is nil, the
metatable of the given table is removed. If the original metatable has a
@Anaminus
Anaminus / roblox-api-dump.jq
Last active August 19, 2019 15:14
Useful jq filters for the Roblox API dump.
# Select all members, setting Class field to name of members' class.
def SelectMembers: [.Classes[] | .Name as $class | .Members[] | .Class=$class];
# Display name of resulting member.
def MemberName(m): m.Class + "." + m.Name;
# Get names of all members.
def AllMemberNames: SelectMembers | map(MemberName(.));
# Select all members containing type t.
@Anaminus
Anaminus / shrink-partition.md
Created July 28, 2019 16:31
How to shrink a Windows partition

How to shrink a Windows partition

First a shrink with the Disk Management tool is tried, which will hopefully be all that is needed. If that fails, then ntfsresize is used on linux to move otherwise unmovable files to clear the way. diskpart is then used to extend the file system back to the original size, which resolves corruption issues. Even though it is now back at the original size, the files themselves have not been moved back, so it is now possible to do a shrink the normal way.

  1. Use Disk Management to shrink to desired size.
  2. If partition cannot be shrinked to desired size, continue.
@Anaminus
Anaminus / dlasset.bat
Created June 20, 2019 15:58
Use rbxmk to download a Roblox asset to a file.
:: dlasset [asset id] [output file]
@echo rbxmk.delete{rbxmk.output{"%2"}};rbxmk.map{rbxmk.input{format="rbxm","rbxassetid://%1"},rbxmk.output{"%2"}} | rbxmk