Skip to content

Instantly share code, notes, and snippets.

@gesslar
gesslar / github.lua
Last active November 15, 2024 01:20
Glass for GitHub
local GitHubClass = Glu.glass.register({
class_name = "GitHubClass",
name = "github",
inherit_from = "http",
setup = function(___, self, opts, container)
local gh_api_base = "https://api.github.com/repos/%s/%s/"
function self.get_latest_release(owner, repo, cb)
local url = string.format(gh_api_base .. "releases/latest", owner, repo)
local response = self.get({ url = url }, function(response)
@gesslar
gesslar / glue_demo_queue_dependency.lua
Last active October 29, 2024 18:38
Glu demo - Queue and Dependency
-- Instance of Glu
local glu = Glu.new("queue_dependency_demo")
-- The package names we will be uninstalling and installing
local packageNames = {
"ThreshBeep", "ThreshColorPercent", "ThreshCopy", "ThreshKeepalive",
"ThreshURL",
}
-- Convenience function to filter out the packages which are already
@gesslar
gesslar / dfs_maze.c
Last active September 7, 2024 00:45
DFS (Depth-First Search) Maze Generation Algorithm for LPC
inherit STD_VIRTUAL_MAP;
private nosave int *dimensions = ({25, 25}); // width, height
private nosave int WIDTH = 0, HEIGHT = 1;
private nosave mixed *maze;
private nosave int MIN_X = 0, MIN_Y = 1, MAX_X = 2, MAX_Y = 3;
private nosave int WALL = 1;
private nosave int PATH = 0;
@gesslar
gesslar / maze.c
Created September 5, 2024 20:40
sample maze generation
inherit STD_DAEMON ;
void generate(int dim, int numDoors) ;
void add_outer_walls() ;
int add_entrance() ;
void add_inner_walls(int h, int minX, int maxX, int minY, int maxY, int gate) ;
void add_h_wall(int minX, int maxX, int y) ;
void add_v_wall(int minY, int maxY, int x) ;
string display() ;
int do_generate(string arg) ;
@gesslar
gesslar / updatelocalrepos.ps1
Last active July 14, 2024 04:17
updates all local repos - useful after doing things directly online or dependencies got updated
# Define the array of directories
$repos = @(
"mud.gesslar.dev",
"mupdate",
"ThreshBeep",
"ThreshBuff",
"ThreshChat",
"ThreshColorPercent",
"ThreshCommandRepeater",
"ThreshCopy",
@gesslar
gesslar / 1_websocket_echo.c
Created July 1, 2024 00:12
Basic example of using websocket to connect to echo.websocket.org (https://echo.websocket.org/)
// /adm/daemons/websocket_echo.c
// Test websocket with echo.websocket.org
//
// Created: 2024/06/30: Gesslar
// Last Change: 2024/06/30: Gesslar
//
// 2024/06/30: Gesslar - Created
#include <daemons.h>
#include <websocket.h>
@gesslar
gesslar / MuddleHelper.lua
Last active June 21, 2024 03:23
Script for managing Muddler automatic uninstall/re-install
-- After making changes to the items table, you will need to run: lua resetProfile()
-- So that it will reload.
MuddleHelper = MuddleHelper or {
items = {
{ name = "ThreshBuff", path = "D:/git/threshbuff", active = true, helper = nil },
{ name = "ThreshKeepalive", path = "D:/git/ThreshKeepalive", active = true, helper = nil },
{ name = "ThreshColorPercent", path = "D:/git/ThreshColorPercent", active = true, helper = nil },
}
}
@gesslar
gesslar / release.yml
Created June 20, 2024 21:50
GitHub workflow for automatically compiling and creating a release whenever you push to GitHub, except from PRs
name: Build project using muddler and upload artifact
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
@gesslar
gesslar / sid.js
Created May 2, 2024 19:19 — forked from Krizzzn/sid.js
Convert binary buffer object SID to string
/*
# Convert binary encoded object SID to a string
# (eg. S-1-5-21-1004336348-1177238915-682003330-512)
#
# SID format: https://technet.microsoft.com/en-us/library/cc962011.aspx
#
# ldapjs `searchEntry` has attribute `raw` that holds the raw
# values, including the `objectSid` buffer when one exists. Pass that
# buffer to get the string representation that can then be easily
# used in LDAP search filters, for example.
@gesslar
gesslar / sid.js
Created May 2, 2024 19:19 — forked from Krizzzn/sid.js
Convert binary buffer object SID to string
/*
# Convert binary encoded object SID to a string
# (eg. S-1-5-21-1004336348-1177238915-682003330-512)
#
# SID format: https://technet.microsoft.com/en-us/library/cc962011.aspx
#
# ldapjs `searchEntry` has attribute `raw` that holds the raw
# values, including the `objectSid` buffer when one exists. Pass that
# buffer to get the string representation that can then be easily
# used in LDAP search filters, for example.