Skip to content

Instantly share code, notes, and snippets.

@meepen
meepen / hook.lua
Last active January 2, 2022 13:55
NEW GMOD HOOKS 70,000% FASTER - new LINKED LIST version available now for purchase (FREE PRIORITIZATION INCLUDED)
hook = include "newhook.lua"
@meepen
meepen / non-powerof2-png-gmod.lua
Last active February 22, 2021 17:40
Loads non power of 2 PNG into a Garry's Mod texture without fucking over scaling.
local function wait_png(matstr)
local html = vgui.Create("DHTML")
html:AddFunction("console", "memeify", function()
html.done = true
end)
local mat = Material(matstr)
local rw, rh = mat:GetInt "$realwidth", mat:GetInt "$realheight"
local f = file.Open("materials/"..matstr, "rb", "GAME")
local cont = f:Read(f:Size())
@meepen
meepen / materialmeepen.lua
Last active February 5, 2017 04:38
A Derma skin for Garry's Mod. Mimics Windows 10 a bit.
local surface = surface
local draw = draw
local Color = Color
surface.CreateFont("MaterialMeepen", {
font = "Tahoma",
size = 13,
weight = 500,
antialias = true,
extended = true
@meepen
meepen / lujlu.lua
Last active February 25, 2026 15:10
LuaJit VM in Lua. Comes with fully operational bytecode interpreter. License is: contact me before using it commercially. - Now runs itself inside itself and itself inside itself inside itself
local bytecodes = {}
local BC, run_function = {}
local VARG_CONST = {}
local lujlu_mt_funcs
local lujlu_cache = setmetatable({}, {__mode = "k"})
local lujlu_identifier_mt = {
__tostring = function(self)
return tostring(lujlu_cache[self].data)
end,
local red = Color(255,0,0)
local green = Color(0,255,0)
local function log(color,s)
MsgC(color,s .. "\n")
end
function mdmp(out)
local files,_ = file.Find("*.mdmp","BASE_PATH")
if out then log(red,"Found " .. #files .. " files!") end
@meepen
meepen / outline.lua
Last active June 5, 2020 04:46
Outliner
function render.CreateOutlineData(length, passes, color)
local step = length * 2 / 2 ^ (math.Round(passes) - 1)
local matrices = {}
for coord = -length, length, step do
matrices[#matrices + 1] = Matrix()
matrices[#matrices]:Translate(Vector(0, 0, coord))
matrices[#matrices + 1] = Matrix()
@OmegaExtern
OmegaExtern / SourceScheme.res
Created October 12, 2015 15:05
"DodgerSky" skin for Source engine games. Originally written for Garry's Mod game.
///////////////////////////////////////////////////////////
// <DodgerSky> skin created by OmegaExtern.
// Quick rewrite of the skin I have lost a few days ago.
// Originally written for Garry's Mod game.
//
// Installation:
// Copy this file into the following folder: [Steam installation directory]\steamapps\common\GarrysMod\garrysmod\resource.
///////////////////////////////////////////////////////////
// Tracker scheme resource file
//
@randrews
randrews / hoc4.lua
Created June 21, 2015 20:53
Toy calculator in Lua, version 4
setmetatable(_ENV, { __index=lpeg })
Scopes = { {} }
function eval_expr(expr)
local accum = eval(expr[2]) -- because 1 is "expr"
for i = 3, #expr, 2 do
local operator = expr[i]
local num2 = eval(expr[i+1])
@mentlerd
mentlerd / sh_grep.lua
Created January 28, 2015 12:10
Pretty printing for gmod13
-- Global 'nil' value
NIL = {}
-- Localise for faster access
local pcall = pcall
local string_len = string.len
local string_sub = string.sub
local string_find = string.find