Skip to content

Instantly share code, notes, and snippets.

View JaredSartin's full-sized avatar

Jared Sartin JaredSartin

View GitHub Profile
@GlorifiedPig
GlorifiedPig / hook.lua
Last active April 21, 2023 12:12
Lua Hook Library
--- A library used for calling and attaching hooks.
-- @module Hook
Hook = {}
local cachedHooks = {}
--- Attaches a function to a hook.
-- @string hookID The string ID of the hook to be attached to.
-- @string uniqueID The unique ID of the function you are attaching to the hook.
-- @func func The function to be called when the hook is called.
@tarrouye
tarrouye / Main.lua
Created June 11, 2015 03:16
Multiplayer Class (and Drawing Example)
function setup()
local connectionMade = function()
output.clear()
parameter.clear()
print("Connected!")
gameSetup()
end
multihandler = Multiplayer(receiveData, connectionMade)
@inmatarian
inmatarian / lzw.lua
Created December 27, 2014 02:14
LZW Compression in Lua, rosetta-code style, also includes a 8-bit only mode for 7bit plain text strings.
local lzw = {}
local function enc_reset(dict, size)
for k, _ in pairs(dict) do dict[k] = nil end
for i = 0, size-1 do dict[string.char(i)] = i end
return dict
end
local function dec_reset(dict, size)
for k, _ in pairs(dict) do dict[k] = nil end
@johnnyman727
johnnyman727 / listening-client.js
Created September 23, 2014 19:57
Simple MQTT Server. Tessel acts as an MQTT client sending temperature data to a host
var mqtt = require('mqtt')
// Make sure to change this to the IP address of your MQTT server
, host = '192.168.128.204' // or localhost
client = mqtt.createClient(1883, host, {keepalive: 10000});
// Subscribe to the temperature topic
client.subscribe('temperature');
// When a temperature is published, it will show up here
client.on('message', function (topic, message) {
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@briarfox
briarfox / Main.lua
Last active January 14, 2016 22:48
AutoGist AutoInstall
--AutoGist Single Install
--Installer created by @Briarfox
--- This will pull the AutoGist project into Codea for you
-- Instructions:
-- * Create a new project in Codea named AutoGist.
--This is case sensitive
ProjectName = "AutoGist"
-- * Paste this into the Main (not from the raw view, as iSafari will escape special characters)
-- * Make sure there is a single tab in the project
-- * Run and wait for success!
@Deco
Deco / deepcopy.lua
Created October 31, 2012 05:38
Lua Non-recursive Deep-copy
--[[ deepcopy.lua
Deep-copy function for Lua - v0.2
==============================
- Does not overflow the stack.
- Maintains cyclic-references
- Copies metatables
- Maintains common upvalues between copied functions (for Lua 5.2 only)
TODO