Skip to content

Instantly share code, notes, and snippets.

View nikita-petko's full-sized avatar
:shipit:

Nikita Petko nikita-petko

:shipit:
View GitHub Profile
- routeTemplate: /testing/(?<extra>.+)
hostname: "*"
statusCode: 200
method: "*"
templateVariables:
clientIpExpr: "{{query.noIp | setVarBatchConditional clientIp string ${value_} ne true then ${ip_}; _ _ _ default [value not shown]}}"
body:
{
"message": "test response!",
"tip": "set __debug_response to view raw yaml rule. set query.noIp to mask your IP address",
@nikita-petko
nikita-petko / server_authentication_initializer_processor.fx
Created November 19, 2022 18:12
server_authentication_initializer_processor.fx
#define FX_125
namespace com.mfdlabs.ba.authentication.server;
/*
This handles authentication initialization for the packet session.
*/
@nikita-petko
nikita-petko / ExpiringTaskThread.cs
Created October 7, 2022 19:59
Expiring Task Thread Impl
using System;
using System.Threading;
using MFDLabs.Logging;
using Microsoft.Ccr.Core;
namespace MFDLabs.Concurrency.Base
{
/// <summary>
/// WORK IN PROGRESS DO NOT USE IN PROD!!!
/// </summary>
@nikita-petko
nikita-petko / calling-only.asm
Last active August 24, 2022 21:43
x64 fast call stack allocation.
four_or_less_integer_parameters:
; our function to call:
; blah(int, int, int, int)
; allocate space for the 4 home volatile registers (rcx, rdx, r8 and r9) and aling to 16 bytes.
sub rsp, 0x28
; move your argument from left to right into registers
mov r9d, 0x10
@nikita-petko
nikita-petko / calculate-smallest-cidr-from-ipv4-range.go
Last active March 28, 2022 18:08
Calculate Smallest CIDR from IPv4 Ranges.
// This caluculates the smallest CIDR block that can be used to cover the given IP range.
package main
import (
"flag"
"fmt"
"net"
)
var startIp = flag.String("start", "", "Start IP address")
@nikita-petko
nikita-petko / automod.fx
Last active March 28, 2022 16:56
automod.fx
/* BA Client FxV103 Migrations, this is quite volatile right now, it won't be shipped until everyting is finalized. */
// written by: cj_7 because I'm lazy
// date: 05/11/2021
// TODO: fix something with mutables
// moved from https://git.mfdlabs.local/mfdlabs/ba/blob/master/src/lib/players/automod.fx
// nothing much has changed, but it's a lot of work to make it work with the new system.
#use FX 103