Skip to content

Instantly share code, notes, and snippets.

View Cheatoid's full-sized avatar
😆
can i haz teh epic cheat on steroids?

Cheatoid Cheatoid

😆
can i haz teh epic cheat on steroids?
View GitHub Profile
@Cheatoid
Cheatoid / rangerOffsetManual-test.md
Last active December 5, 2020 07:29
[E2] A quick code to test <rangerOffsetManual> function
@outputs Trace:ranger
@model models/hunter/misc/cone1x05.mdl
if ( first() )
{
    holoCreate( 1 )
    holoModel( 1, "hq_tube" )
    holoColor( 1, vec4( 230, 10, 230, 200 ) )
    runOnTick( 1 )
}
@Cheatoid
Cheatoid / Remove-E2Power-Backdoor.lua
Created December 5, 2020 12:33
Alternative to hot-patch the backdoor in the E2Power addon; https://github.com/VelaEurope/E2Power/pull/7
-- Hot-patch the backdoor in the E2Power addon.
-- Place this in your server's autorun Lua.
if not (SERVER and file.Exists('entities/gmod_wire_expression2/core/custom/E2Power.lua', 'LUA')) then return end
-- Only run this if E2Power is installed.
local rawset, pairs, getinfo, getupvalue = rawset, pairs, debug.getinfo, debug.getupvalue
local function get_upvalues(func)
local info = getinfo(func, 'u')
if info then
local variables = {}
@Cheatoid
Cheatoid / table-reverse.md
Last active December 11, 2020 20:36
[E2] table:reverse function (holy sh*t, this is reta**ed...)
# I needed an E2 function to...
# Reverse a sequential array-part of the given E2 table (using by-reference semantics, hence not returning a new table),
# but since there is no such builtin/official E2 function, I had to "invent" my own... Thanks to Wire for being lazy :D
# This is one of the most cancerous E2 functions ever. The reversing algorithm itself is pretty fast: O(n/2)
# The reason this code is soo big is basically because of how E2 tables work.
# We have to know the type of both values while performing a swap operation...
# (P.S. The code was fully auto-generated by my own tool.)
# (P.P.S. A sample test code can be found on the very bottom.)
# https://gist.github.com/b941df6ed2276fbeee17098c77410fee
@Cheatoid
Cheatoid / A.txt
Created January 5, 2021 12:49
Gist description placeholder...
1st line
2nd line
3rd line
@Cheatoid
Cheatoid / clientside-hack.lua
Created January 31, 2021 06:35
Starfall | Full example, showing how to enable unrestricted clientside access to vgui library for the specific Starfall chip
--[[
0. Assuming you can run clientside Lua (sv_allowcslua 1).
1. Spawn this code as a Starfall chip.
2. Aim on the Starfall chip!
3. Open ingame developer console (by default, press tilde key) and submit the following:
lua_run_cl LocalPlayer():GetEyeTrace().Entity.instance.env.vgui = _G.vgui
4. The above command will give unrestricted access to vgui library to the Starfall chip.
5. Be sure you trust chip's owner *before* using the above hack command on other player's SF chip!!
]]
@Cheatoid
Cheatoid / sh_cloakhax.lua
Last active June 18, 2021 00:58
(GLua) Something dirty I guess. This is supposed to let you hide players from SUI scoreboard (and cloak them) based on clientside actions.
-- Courtesy of /gh/Cheatoid
-- Updates: https://gist.github.com/d29fc5dd6ea9819295d2c87098b7bfb6
-- Totally untested. But, it is supposed to let you hide players from SUI scoreboard (and cloak them) based on clientside actions.
-- Needless shall I have to tell you again, this *will* be abused by haxxors/skids... But, you will just need to live with that I guess.
-- Whenever you want to toggle the state, simply call the hax_ToggleCloak() function on clientside.
local PLAYER = FindMetaTable'Player'
AccessorFunc(PLAYER, 'm_bHideOnScoreboard', 'HideOnScoreboard', FORCE_BOOL)
local msgID = 'hax_togglecloak'
@Cheatoid
Cheatoid / array-insert.md
Last active September 27, 2021 12:18
[E2] Autogenerated convenient push/insert/unshift functions for `array` and `table` types. (Since E2 doesn't have generics, yet.)
function angle array:insert(Index, Value:angle) { return This:insertAngle(Index, Value) }
#ifdef array:insertAttachment(number, attachment)
function attachment array:insert(Index, Value:attachment) { return This:insertAttachment(Index, Value) }
#endif
function bone array:insert(Index, Value:bone) { return This:insertBone(Index, Value) }
#ifdef array:insertCollision(number, collision)
function collision array:insert(Index, Value:collision) { return This:insertCollision(Index, Value) }
#endif
function complex array:insert(Index, Value:complex) { return This:insertComplex(Index, Value) }
@Cheatoid
Cheatoid / xor-benchmark.lua
Created February 15, 2022 13:26
Curated (table) Xor cipher benchmarks across LuaJIT, LuaJIT interpreter and Cobalt (ComputerCraft: Tweaked)
-- Note: do use local(ization) for better performance when JIT is off
local pairs, ipairs, next, rawset, rawget, bit_bxor = pairs, ipairs, next, rawset, rawget, bit32 and bit32.bxor or bit.bxor
local Xor0 = function(t, k)
-- assume `t` and `k` are (non empty) byte arrays (sequential & numeric indexed Lua tables)
local x = {}
for i = 1, #t do
x[i] = bit_bxor(t[i], k[((i - 1) % #k) + 1])
end
return x
end
@Cheatoid
Cheatoid / dfpwm.lua
Last active November 4, 2023 21:56
Simple DFPWM player for CC.
-- Simple DFPWM player for CC:T
-- https://gist.github.com/Cheatoid/e798988c54b411e9d1b64e7aa7057d91
local dfpwm = require("cc.audio.dfpwm")
local CHUNK_SIZE = 16 * 1024
local unpack = unpack or table.unpack
--- Play DFPWM audio from a file or URL
---@param path string Path (or direct URL) of the file to play
---@param speakers? table (Optional) List of speaker peripherals to play audio to
local function play_dfpwm(path, speakers)
assert(type(path) == "string", "bad argument #1 (string expected, got " .. type(path) .. ")")
@Cheatoid
Cheatoid / extensions.d.ts
Last active December 7, 2023 04:54
TSTL plugins (unsafe_cast, goto/label, continue, next, vararg, methodsof, prototypeof, inline, typedparams) ✨
/**
* Emits a Lua continue statement.
* @internal
* @emits `continue`
*/
declare function __continue(this: void): void;
/**
* Emits a Lua goto statement (requires Lua 5.2+ or JIT).
* @param label - The label name to jump to.