Skip to content

Instantly share code, notes, and snippets.

@exerro
exerro / gotcha.lua
Created January 27, 2023 20:20
gotcha
local function safeIndex(t, ...)
for _,v in ipairs({...}) do
t = t[v]
if not t then return nil end
end
return t
end
local function safeIndex2(t, ...)
@exerro
exerro / pathlib.lua
Last active January 11, 2023 12:59
Lua path library
--[[ Path library for Lua (by exerro aka Benedict Allen)
Create a path using
local p = Path 'my/directory'
Combine paths like
local file = p / 'subdir' / 'myfile.txt'
@exerro
exerro / ccgl3d-1.lua
Last active August 24, 2022 20:04
First 3D rendering demo using CCGL3D
local __localmodules = {}
local __localmodulecache = {}
local __localmodulelines = {}
local __require = require
local function require(module)
local f = __localmodules[module]
if not f then return __require(module) end
local result = __localmodulecache[module]
if result == nil then
__localmodulecache[module] = true

Keybase proof

I hereby claim:

  • I am exerro on github.
  • I am shady_duck (https://keybase.io/shady_duck) on keybase.
  • I have a public key ASBLFcvOXMCfPW7Vwe0EtbjaIwzyCdE2iBfgyyKFA7pahAo

To claim this, I am signing this object:

local args = { ... }
local config
local CONFIG_PATH = ".ccsync.conf.lua"
local ERR_CONFIG_FAIL = "Failed to open CCSync config file"
local CONFIG_KEY_URL = "basic:url"
local CONFIG_KEY_LOCALPATH = "basic:localpath"
local PROMPT_URL = "URL:"
local PROMPT_LOCALPATH = "Local path:"

Control interface

This document defines the structure and parameters of messages sent between the Arduino microcontroller on either robot, and the Raspberry Pi on the secondary robot which handles high level logic and control

Message structure

struct Message {
	char command;
@exerro
exerro / c#
Created November 28, 2018 20:31
Pair<A<T>, A<U>> ApplyBoth<T, U>(f: forall. Function<X, A<X>>, (a, b): Pair<T, U>) {
return (f(a), f(b)) // Yeah, I made this syntax up
}
grammar Flux;
type Name = string[]
enum AST {
enum RootStatement {
NamespaceStatement(Name, RootStatement[])
EnumDefinition(Name, Template, EnumBody)
ClassDefinition(bool, bool, Name, Template, Type.Reference, Type.Reference[], ClassBodyStatement[]) // final abstract
package Flux;
import java.util.ArrayList;
import parsing.Position;
public abstract class AST {
public static enum NodeType {
Statement,
Expression,
Definition,
local diff = e1.position:sub( e2.position );
local dist = diff:len();
local radius = e1.shape.radius + e2.shape.radius;
if dist < radius then
return Collision( e1, e2, radius - dist, diff:div( dist ) )
end