Skip to content

Instantly share code, notes, and snippets.

@ninjadynamics
ninjadynamics / chat.c
Created October 3, 2024 14:57
LlamaCPP Chat Inference in C
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h> // For INFINITY
#include "llama.h"
#define MODEL_PATH "llama-3.2-1b-instruct-q8_0.gguf"
@ninjadynamics
ninjadynamics / carsim.c
Last active June 12, 2024 14:15
Drag Racing Simulator (raylib)
/*
MIT License
Copyright (c) Ninja Dynamics
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
#include <stdio.h> // Include standard input/output header
int main() {
char name[50]; // Declare an array of chars to store the name
int age; // Declare an integer to store the age
printf("Enter your name: "); // Prompt the user to enter their name
scanf("%49[^\n]", name); // Read a string from the user input including spaces
getchar(); // Consume the newline character to avoid issues with subsequent inputs
@ninjadynamics
ninjadynamics / crt-mattias.slang
Last active November 18, 2024 08:47
CRT-Mattias-Blur
#version 450 // Specify the GLSL version to use
// CRT Emulation
// by Mattias
// https://www.shadertoy.com/view/lsB3DV
// Updated 2024.11.17 by Ninja Dynamics
// Define a push constant block to pass parameters to the shader
layout(push_constant) uniform Push {
@ninjadynamics
ninjadynamics / Beetle PSX HW
Created January 6, 2024 19:16
Chrono Cross - Beetle PSX HW Config
beetle_psx_hw_adaptive_smoothing = "disabled"
beetle_psx_hw_analog_calibration = "disabled"
beetle_psx_hw_analog_toggle = "disabled"
beetle_psx_hw_analog_toggle_combo = "l1+r1+select"
beetle_psx_hw_analog_toggle_hold = "1"
beetle_psx_hw_aspect_ratio = "corrected"
beetle_psx_hw_cd_access_method = "sync"
beetle_psx_hw_cd_fastload = "2x(native)"
beetle_psx_hw_core_timing_fps = "force_progressive"
beetle_psx_hw_cpu_dynarec = "execute_one"
.segment "CODE"
.export _famitone_init,_famitone_update
.export _music_play,_music_stop,_music_pause
;from mmc3.h
.importzp _music_bank,_sfx_bank,_dpcm_bank
.importzp _mmc3_cpu_bank, _mmc3_register
.importzp _mmc3_last_register, _mmc3_last_cpu_bank
.importzp _active_data_bank,_active_data_bank_index