Skip to content

Instantly share code, notes, and snippets.

View codenulls's full-sized avatar

Danish AKA codenulls codenulls

View GitHub Profile
@codenulls
codenulls / bug_analysis_vercel_ai.md
Created November 6, 2025 08:43
Tool call race condition analysis

The original code's strategy of intercepting the finishChunk was absolutely correct in principle. The failure was in the mechanism it used to decide when to release that chunk. It was a manual, fragile system that broke under specific timing conditions.

Think of it like a relay race with two runners who need to finish at the same time.

  • Runner A: The Tool Executor. Its job is to run the tool and report back.
  • Runner B: The Model Stream. Its job is to send all its data and then signal that it's done.
  • The Finish Line: The attemptClose() function, which is supposed to end the step.
  • The Rule: The step can only end when both runners are at the finish line.

The problem is that the two runners were not properly synchronized. They were checking for each other's status using separate flags (canClose and outstandingToolResults.size).

@codenulls
codenulls / trace_execution_x64dbg.py
Last active November 10, 2023 01:14
Stops the execution at conditional jumps. The output is printed to the log file in x64dbg.
# taken from https://gist.github.com/deeso/44e6dc40ea7a4d77fc458742eb96f4c1
from x64dbgpy import pluginsdk
import x64dbgpy.pluginsdk._scriptapi as script
def loadBytes(va, count):
return list(script.Read(va, count))
def disasm_at(addr):
@codenulls
codenulls / _jmp_deobfuscator.md
Created November 9, 2023 11:09 — forked from oopsmishap/_jmp_deobfuscator.md
IDA Jmp Deobfuscation Script
@codenulls
codenulls / smtpenum.py
Created October 6, 2023 20:02 — forked from tommelo/smtpenum.py
SMTP User Enumeration
#!/usr/bin/env python
import socket, getopt, sys, os.path
SMTP_PORT = 25
BUFFER_SIZE = 1024
OK_STATUS = 252
APP_NAME = "smtpenum"
VERSION = "1.0.0"
@codenulls
codenulls / SimpleAsmExample.cpp
Created March 4, 2021 19:30
prints: 0 2 4 6 8 10 12 14 16 18
#include <stdio.h>
#include <stdint.h>
#include <Windows.h>
#include <iostream>
void __cdecl PrintNumber(int i)
{
printf("%d ", i);
}
@codenulls
codenulls / gist:465375556cb282892b8b76eee3e09b15
Last active February 27, 2021 22:17
ubuntu ffmepg build with openssl
export CFLAGS="-I/usr/local/ssl/include -L/usr/local/ssl/lib -Wl,-rpath=/usr/local/ssl/lib"
CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" ./configure \
--pkg-config=pkg-config \
--prefix=$PWD/../ffmpeg-win32-sdk \
--enable-static \
--enable-shared \
--enable-small \
--disable-symver \
--disable-debug \
--disable-doc \
@codenulls
codenulls / PrintAllGroupsGTA3_pluginSDK.cpp
Last active January 14, 2019 10:20
Print all GTA III animation groups by pressing 1.
#include "plugin.h"
#include "common.h"
#include "CTimer.h"
#include "InputManager.h"
#include "CAnimManager.h"
using namespace plugin;
class GTA3Animation {
public:
@codenulls
codenulls / main.scm
Created January 1, 2019 10:47 — forked from wodim/main.scm
main.scm from GTA: Vice City
This file has been truncated, but you can view the full file.
DEFINE OBJECTS 204
DEFINE OBJECT (noname)
DEFINE OBJECT DTN_STADDOORA // Object number -1
DEFINE OBJECT DTN_STADDOORB // Object number -2
DEFINE OBJECT DTHOTRING_A // Object number -3
DEFINE OBJECT BRIBE // Object number -4
DEFINE OBJECT CI_GATESCLOSED // Object number -5
DEFINE OBJECT CI_BACKGATECLOSE // Object number -6
DEFINE OBJECT INFO // Object number -7
DEFINE OBJECT YT_MAIN_BODY // Object number -8
@codenulls
codenulls / GetAllTaskNames.cpp
Created December 26, 2018 18:20
Function for getting all task names for MTA SA.
bool CClientGame::GetLocalPlayerTaskNames(SString& strConcatenatedTaskNames, bool bPrimary)
{
CClientPed* pLocalPlayer = static_cast<CClientPed*>(GetLocalPlayer());
if (pLocalPlayer)
{
int cTaskTypes = bPrimary ? 5 : 6;
for (int iTaskType = 0; iTaskType < cTaskTypes; iTaskType++)
{
std::vector<SString> taskHierarchy;
if (CStaticFunctionDefinitions::GetPedTask(*pLocalPlayer, bPrimary, iTaskType, taskHierarchy))
@codenulls
codenulls / PlayerClassMemoryLayout.cpp
Created November 23, 2018 14:21
Shows how the `Player` class looks in memory, and how to access it.
// GTA_test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <cstdio>
#include <cstdint>
class Player
{
public: