Skip to content

Instantly share code, notes, and snippets.

@luoxz-ai
luoxz-ai / grpo_demo.py
Created February 7, 2025 07:40 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
@luoxz-ai
luoxz-ai / main-sdl.c
Created December 19, 2024 01:24 — forked from binji/main-sdl.c
FunkyKarts wasm2c main
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define GL_GLEXT_PROTOTYPES
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@luoxz-ai
luoxz-ai / vim-unreal.md
Created March 27, 2023 11:55 — forked from chillpert/vim-unreal.md
Debugging and autocompletion for Unreal Engine 4 and 5 projects in (Neo)vim

Debugging and autocompletion for Unreal Engine 4 and 5 projects in (Neo)Vim

+++ Updated for UE 5.1 (see bottom)

Autocompletion

For autocompletion there are two options:

  1. coc (Vim, Neovim)
  2. LSP (Neovim only)
@luoxz-ai
luoxz-ai / Draw3DAgentComponent-use-case.cpp
Created May 19, 2022 10:31 — forked from alleysark/Draw3DAgentComponent-use-case.cpp
Explain how to use the Draw3DAgentComponent
Draw3DAgent->CreateDynMeshElemDelegate.BindLambda(
[this](const FSceneView* View, class FPrimitiveDrawInterface* PDI, const FMatrix& LocalToWorld)
{
FVector CameraX, CameraY;
UDraw3DAgentComponent::GetCameraAxis(View, CameraX, CameraY);
FVector Loc = GetActorLocation();
DrawCircle(PDI, Loc, CameraX, CameraY, FLinearColor::Red, 20.f, 16, SDPG_Foreground, 3.f);
PDI->DrawLine(Loc, Loc + FVector::ForwardVector * 10.f, FLinearColor::Red, SDPG_Foreground);
#pragma once
#include "Draw3DAgentComponent.generated.h"
UENUM(BlueprintType)
enum class ESceneDepthPriorityGroupProxy : uint8
{
/** World scene DPG. */
SDPGP_World UMETA(DisplayName="World"),
/** Foreground scene DPG. */
SDPGP_Foreground UMETA(DisplayName="Foreground")
#include "Sandbox.h"
#include "Draw3DAgentComponent.h"
UDraw3DAgentComponent::UDraw3DAgentComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
bHiddenInGame = false;
bCastDynamicShadow = false;
bDrawOnlyIfSelected = false;
@luoxz-ai
luoxz-ai / imgui_memory_editor.h
Created July 7, 2021 13:49 — forked from ocornut/(Archived) imgui_memory_editor.h
Mini memory editor for dear imgui (to embed in your game/tools)
// Mini memory editor for Dear ImGui (to embed in your game/tools)
// Animated GIF: https://twitter.com/ocornut/status/894242704317530112
// THE MEMORY EDITOR CODE HAS MOVED TO GIT:
// https://github.com/ocornut/imgui_club/tree/master/imgui_memory_editor
// Click "Revisions" on the Gist to see old version.
@luoxz-ai
luoxz-ai / opengl-transparency-demo.cpp
Created February 2, 2020 13:55 — forked from wilkie/opengl-transparency-demo.cpp
Rendering directly to a composited window in vista+ with opengl.
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include <windowsx.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <dwmapi.h>
#pragma comment (lib, "opengl32.lib")
@luoxz-ai
luoxz-ai / .ycm_extra_conf.py
Created August 16, 2018 05:23 — forked from Squareys/.ycm_extra_conf.py
YCM Configuration for UE4
#
# YCM configuration for Unreal Engine 4 projects
#
# Parses a generated Visual Studio project file and extracts its
# include dirs and symbols to be passed on to ycm/libclang.
#
# Note: For me this worked only on some files, but crashed ycm on others
# (using YCM with libclang-3.9.?, if I remember correctly...). May work
# better with newer versions?
#