Skip to content

Instantly share code, notes, and snippets.

View rannmann's full-sized avatar

Jake Forrester rannmann

View GitHub Profile
@rannmann
rannmann / AucScandataToJSON.lua
Last active September 11, 2021 22:35
Auc-ScanData.lua to JSON
-- JSON library and Auc-ScanData.lua should be in the same directory as this file.
JSON = (loadfile "JSON.lua")() -- http://regex.info/blog/lua/json
data = load(loadfile "Auc-ScanData.lua")()
local itemKeys = {
LINK = 1, -- Used
ILEVEL = 2, -- Used
ITYPE = 3, -- Used
ISUB = 4, -- Used
@rannmann
rannmann / mysql_explain
Last active January 27, 2020 18:22
Debugging and improving sourcebans query
# Before any changes
mysql> explain UPDATE `sb_submissions` SET archiv = '3', archivedby = 48 WHERE archiv = '0' AND (SteamId IN((SELECT authid FROM `sb_bans` WHERE `type` = 0 AND `RemoveType` IS NULL)) OR sip IN((SELECT ip FROM `sb_bans` WHERE `type` = 1 AND `RemoveType` IS NULL)));
+----+--------------------+----------------+------------+------+---------------+------+---------+------+-------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+--------------------+----------------+------------+------+---------------+------+---------+------+-------+----------+-------------+
| 1 | UPDATE | sb_submissions | NULL | ALL | NULL | NULL | NULL | NULL | 758 | 100.00 | Using where |
| 3 | DEPENDENT SUBQUERY | sb_bans | NULL | ALL | NULL | NULL | NULL | NULL | 20239 | 1.00 | Using where |
| 2 | DEPENDENT SUBQUERY | sb_bans | NUL
72.44.32.0/19
67.202.0.0/18
75.101.128.0/17
174.129.0.0/16
204.236.192.0/18
184.73.0.0/16
184.72.128.0/17
184.72.64.0/18
50.16.0.0/15
50.19.0.0/16
@rannmann
rannmann / SteamUserFunctions.php
Last active August 31, 2023 15:03
Convert Steam IDs to and from Community IDs and User IDs
<?php
/* Examples
toSteamID(25490879) // STEAM_0:1:12745439
toSteamID(76561197985756607) // STEAM_0:1:12745439
toSteamID("STEAM_0:1:12745439") // STEAM_0:1:12745439
toUserID(25490879) // 25490879
toUserID(76561197985756607) // 25490879
toUserID("STEAM_0:1:12745439") // 25490879