Skip to content

Instantly share code, notes, and snippets.

View Earu's full-sized avatar
🤸‍♂️
Making LLMs actually useful.

Ryan Earu

🤸‍♂️
Making LLMs actually useful.
  • France
View GitHub Profile
@Earu
Earu / fs_hider.lua
Last active January 23, 2022 12:55
Naughty script that allows you to hide files in Garry's Mod. Lua replacement for gm_fshook.
-- if you don't trust the hook library at this point you might wanna
-- replace this with a local callback of sorts
hook.Add("ShouldHideFile", "", function(_, path)
if path:match("custom_file.lua") then return true end
end)
-- hide our detours
local debug_info_cache = {}
local old_debug_getinfo = debug.getinfo
function debug.getinfo(fn, ...)
@Earu
Earu / advanced_server_search_query.lua
Last active April 16, 2022 14:08
An advanced Garry's Mod server search query processor.
local function parse_host_name_tags(host_name)
local tags = {}
local function add_tag(tag)
tag = tag:Trim()
if #tag > 1 and #tag < 15 then
table.insert(tags, tag)
end
end
local start_index, _ = host_name:find("[%|%,%-]")
@Earu
Earu / [hackerrank]_Simple_Text_Editor.cs
Last active May 17, 2022 22:48
Code for the "Simple Text Editor" challenge on hackerrank.com
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
class Operation
{
protected readonly Stack<Operation> operationStack;
protected readonly string context;
@Earu
Earu / [hackerrank]_Jesse_and_cookies.cs
Last active October 10, 2024 13:11
Code for the "Jesse and cookies" challenge on hackerrank.com
/*
Jesse loves cookies and wants the sweetness of some cookies to be greater than value K.
To do this, two cookies with the least sweetness are repeatedly mixed. This creates a special combined cookie with:
(least sweet cookie) + (2 * (second least sweet cookie))
This occurs until all the cookies have a sweetness >= K.
Given the sweetness of a number of cookies, determine the minimum number of operations required. If it is not possible, return -1.
*/
using System.CodeDom.Compiler;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
@Earu
Earu / [hackerrank]_Tree_Preorder_Traversal.cpp
Last active May 19, 2022 19:47
Tree: Preorder Traversal challenge on hackerrank.com
#include <bits/stdc++.h>
#include <stack>
using namespace std;
class Node {
public:
int data;
Node *left;
Node *right;
@Earu
Earu / [hackerrank]Tree_huffman_decoding.cpp
Last active May 19, 2022 21:18
Tree: Huffman decoding challenge on hackerrank.com
#include <stack>
string get_sequence(vector<int> source)
{
string ret;
for (int i = 0; i < source.size(); i++)
{
ret.push_back(to_string(source[i])[0]);
}
@Earu
Earu / chatsounds_parser.lua
Last active June 11, 2022 12:23
Generic asynchronous chatsounds lua parser
module("chatsounds_parser", package.seeall)
function is_gmod_env()
return _G.VERSION and _G.VERSIONSTR and _G.BRANCH and _G.vector_origin -- these should be unique enough to determine that we're in gmod
end
lookup = {}
-- abstract away these methods are they are environement specific and we don't want to be constrained to gmod
function build_lookup()
@Earu
Earu / gmod_find_vpns.lua
Last active September 27, 2022 16:58
Find IPs that match known VPNs and proxy servers in Garry's Mod.
local BASE_URL = "https://raw.githubusercontent.com/X4BNet/lists_vpn/main/ipv4.txt"
local IP_PATTERN = "(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)%.(%d%d?%d?)"
local IP_RANGE_PATTERN = "(%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?)/(%d+)"
local function str_to_ip(str)
local o1, o2, o3, o4 = str:match(IP_PATTERN)
o1, o2, o3, o4 = tonumber(o1), tonumber(o2), tonumber(o3), tonumber(o4)
return bit.bor(
o1 * 2 ^ 24,
@Earu
Earu / Matrix.tsx
Last active October 10, 2024 13:10
A simple matrix effect adapted into a React component.
import { HTMLAttributes, useEffect, useRef } from "react";
export default function Matrix(props: HTMLAttributes<HTMLCanvasElement> & { stripCount?: number }): JSX.Element {
const canvasRef = useRef<HTMLCanvasElement>(null);
useEffect(() => {
const canvas = canvasRef.current;
if (!canvas) return;
const context = canvas.getContext('2d');