Skip to content

Instantly share code, notes, and snippets.

View Be1zebub's full-sized avatar
❤️
Incredible-GMod.ru

Beelzebub Be1zebub

❤️
Incredible-GMod.ru
View GitHub Profile
@Be1zebub
Be1zebub / db_tester.php
Last active April 7, 2024 09:18
Script that I use for testing sql connections
<?php
$TIMEOUT = 5; # in seconds
# cli args
# array_shift($argv);
# [$HOST, $DATABASE, $USER, $PASSWORD] = $argv;
# http GET query
# [$HOST, $DATABASE, $USER, $PASSWORD] = $_GET;
function debug.Trace()
local level = 1
Msg( "\nTrace:\n" )
while true do
local info = debug.getinfo( level, "Sln" )
if ( !info ) then break end
@Be1zebub
Be1zebub / markdown-api.lua
Created January 2, 2024 13:47
Markdown api (wip)
-- parse markdown, its portable (can be used in any framework)
local markdown_data = markdown.parse("Hello **bold world!** I use *italic text*.")
-- returns:
{
{
body = "Hello ",
type = "raw"
},
{
body = "bold world!",
@Be1zebub
Be1zebub / deprecated.lua
Last active December 6, 2023 23:19
table.Print deprecated version
-- Deprecated version, see https://github.com/Facepunch/garrysmod/pull/2033 for more details
-- Published for the archive
--[[---------------------------------------------------------
table.Print
A better version of PrintTable
-----------------------------------------------------------]]
local tostringGmodTypes
@Be1zebub
Be1zebub / sortedpairs-bench.lua
Last active November 30, 2023 16:02
bench 4 facepunch/garrysmod pr #2032
local function getKeys( tbl )
local keys = {}
for k in pairs( tbl ) do
table.insert( keys, k )
end
return keys
@Be1zebub
Be1zebub / math.BezierSpline.lua
Created August 1, 2023 21:26
math.BezierSpline.lua
local spline = math.BezierSpline( {
Vector( 128, 128 ),
Vector( 384, 128 ),
Vector( 128, 384 )
} )
hook.Add( "HUDPaint", "math.BezierSpline", function()
surface.SetDrawColor(255, 255, 0)
for i = 1, #spline - 1 do
@Be1zebub
Be1zebub / math.BezierLerp.lua
Created August 1, 2023 21:25
math.BezierLerp.lua
local points = {
Vector( 128, 128 ),
Vector( 384, 128 ),
Vector( 128, 384 )
}
hook.Add( "HUDPaint", "math.BezierLerp", function()
local frac = RealTime() % 1
local point = math.BezierLerp( frac, points )
@Be1zebub
Be1zebub / bezier.lua
Last active August 1, 2023 21:26
bezier.lua
--[[---------------------------------------------------------
Name: BezierLerp( frac, points )
Desc: Lerp point between points with bezier algorithms
-----------------------------------------------------------]]
function math.BezierLerp( frac, points )
local mu = frac * frac
local mum = 1 - frac
local mum2 = mum * mum
-- gmod vs srlion vs dash hook libs
-- to run this rename srlion & dash hook libs to hook_srlion & hook_dash
-- from incredible-gmod.ru with <3
local function sum(tbl)
local out = 0
for i = 1, #tbl do
out = out + tbl[i]
end
return {
You = "Ты",
Yourself = "Себя",
Themself = "Себя",
Everyone = "Всех",
cant_use_as_console = "Вы должны быть игроком, чтобы использовать {S Red} команду!",
no_permission = "У вас нет разрешения на использование '{S Red}'!",
cant_target_multi_players = "Вы не можете настроить цель на нескольких игроков с помощью этой команды.!",