Skip to content

Instantly share code, notes, and snippets.

@x4fx77x4f
x4fx77x4f / hydra5-x64.c
Last active April 17, 2023 05:41
Disable analytics in Teardown
#define NULL ((void*) 0)
__declspec(dllexport) int hydra5_client_connect_developer(void* _1, void* _2) {
return 1;
}
__declspec(dllexport) int hydra5_client_connect_steam(void* _1, void* _2) {
return 1;
}
__declspec(dllexport) void* hydra5_client_create(void* _1) {
return NULL;
}
@x4fx77x4f
x4fx77x4f / tdpth.hexpat
Created March 28, 2023 21:29
TDPTH parser in ImHex Pattern Language
#pragma endian little
#include <std/io.pat>
#include <std/sys.pat>
struct vec_t {
float x;
float y;
float z;
} [[static, format("vec_str")]];
fn vec_str(vec_t vec) {
return std::format("Vec({:.3g}, {:.3g}, {:.3g})", vec.x, vec.y, vec.z);
@x4fx77x4f
x4fx77x4f / osk.lua
Created September 21, 2022 00:21
Work-in-progress on-screen keyboard for StarfallEx
--@client
local osk
do
osk = {}
local function enum(t_in)
local n = #t_in
local bits = 0
repeat
bits = bits+1
@x4fx77x4f
x4fx77x4f / ftq.lua
Last active September 21, 2022 20:46
ESP chip using StarfallEx
--@name FTQ
local using = {}
if SERVER then
net.receive('usage', function(len, player)
net.start('usage')
net.writeEntity(player)
net.writeBool(net.readBool())
net.send()
end)
return
if CLIENT and player() ~= owner() then
return
end
local function test(desc, cond, err)
print((cond and "pass" or "FAIL")..(desc and ": "..desc or ""))
if not cond and err then print(err) end
end
local function test_eq(desc, a, b)
if a == b then
print("pass: "..desc)
@x4fx77x4f
x4fx77x4f / circuit.cfg
Last active January 3, 2022 17:04
Implementation of logic gates and BROKEN binary adder in the form of a Source Engine .cfg file
// Logic gate implementation in Source
// Usage:
// 1. Preprocess this file with cfgpp.lua (or use the preprocessed file below this one) and put it in your game's 'cfg' folder (which will be inside a folder with the name of the game, e.g. 'cstrike' for CS:S, or 'tf' for TF2)
// 2. Run the file by putting this in the developer console: 'exec circuit2' (replace "circuit2" with whatever name you gave the processed file)
// initialization (floating pins will break things)
alias 0
alias 1
alias a 0
alias b 0
@x4fx77x4f
x4fx77x4f / gluaism1.lua
Last active August 17, 2021 23:40
GLua to Lua transpilation test
-- baseclass macro
baseclass = {}
function baseclass.Get(str)
return str
end
DEFINE_BASECLASS('DUMMY')
assert(BaseClass == 'DUMMY', "baseclass failed")
-- comparison operators
local a, b, c = 1, 2, false
if not ( a && b ) then error("and failed") end
@x4fx77x4f
x4fx77x4f / sethook.lua
Created August 17, 2021 20:48
Test for sandboxing debug.gethook/debug.sethook (working around a LuaJIT limitation)
#!/usr/bin/env luajit
--jit.off()
local function host_hook(event, line)
print(string.format("host_hook: line no. %d", line or -1))
end
local function guest_hook(event, line)
print(string.format("guest_hook: line no. %d", line or -1))
end
local mask, count = 'l', 4
local function test(realm, test_no)
@x4fx77x4f
x4fx77x4f / tdedecrypt.lua
Created April 23, 2021 03:55
Decrypt encrypted Teardown files (.tde)
#!/usr/bin/env luajit
local argparse = require('argparse')
local parser = argparse("tdedecrypt", "Decrypt encrypted Teardown files")
parser:argument("input", "Input file(s)"):args("*")
parser:option("-o --output", "Output file")
local args = parser:parse()
if args.input[2] and args.output then
parser:error("cannot use output option with multiple input files")
end
@x4fx77x4f
x4fx77x4f / crowbars.lua
Created April 21, 2021 06:08
Lag out your favorite sandbox server by throwing shittons of crowbars!
--@name Crowbars!
--@client
setupPermissionRequest({'console.command'}, "Crowbars!", true)
local i, j = 0, 50 -- set j to how many times you want to do it
hook.add('tick', '', function()
if not hasPermission('console.command') then
return
end
for i=1, 2 do -- more than twice doesn't work right
concmd('gm_giveswep weapon_crowbar')