Skip to content

Instantly share code, notes, and snippets.

View kevyonan's full-sized avatar
💻
CompEng courses

Kevin Yonan kevyonan

💻
CompEng courses
View GitHub Profile
@kevyonan
kevyonan / matrix_rref_practice.py
Created October 26, 2025 05:37
a matrix script using SymPy to help people practice doing RREF using elementary row operations.
"""Copyright Kevin Yonan MIT license"""
import sympy
sympy.init_printing(use_unicode=True, wrap_lines=True)
## import ALL single-letter symbols
from sympy.abc import *
def eval_csv(msg, as_tup=False):
kb_str_input = input(msg)
return eval('('+kb_str_input+')') if as_tup else eval('['+kb_str_input+']')
@kevyonan
kevyonan / SourcemodPluginAnalyzer.cs
Created June 9, 2025 23:31 — forked from Alienmario/SourcemodPluginAnalyzer.cs
Dumps information from SMX files
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Security.Cryptography;
using System.Text;
/// <summary>Utility for analyzing compiled Sourcemod plugins.</summary>
/// <remarks>
/// Adapted from nosoop's read_sm_plugin.py gist, thanks for making a robust utility that still works after all the years!
@kevyonan
kevyonan / int64.inc
Last active August 6, 2025 00:43
int64 implementation for SourcePawn using an array of int32's. https://forums.alliedmods.net/showthread.php?t=351158
#if defined _int64_included
#endinput
#endif
#define _int64_included
/// x < y
stock bool UInt32LT(int x, int y) {
/// why this works:
/// 0x80000000 < 0 -> has to be false::
/// (0x80000000^0x80000000) < (0^0x80000000)
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <inttypes.h>
struct Rational {
ssize_t numerator;
size_t denominator;
};
@kevyonan
kevyonan / gaussian.c
Last active October 3, 2025 18:56
testing gaussian elimination to solve system of equations.
#include <stdio.h>
#include <math.h>
size_t idx_2_to_1(size_t const idx_dim1, size_t const idx_dim2, size_t const dim_size) {
return (idx_dim1 * dim_size) + idx_dim2;
}
enum RREFResult {
RREFResultOk,
RREFResultFreeVars,
@kevyonan
kevyonan / logic_value.c
Last active March 7, 2025 06:58
truth table printer for binary logic functions
#include <stdio.h>
/// a*b = min(a,b)
int min(int const a, int const b) {
return a < b? a : b;
}
void print_and(size_t const n, int const set[const static n]) {
for( size_t a=0; a < n; a++ ) {
for( size_t b=0; b < n; b++ ) {
@kevyonan
kevyonan / eps.go
Last active September 9, 2024 21:43
calculates epsilon for any device
func epsilon() float64 {
eps := 1.0
for eps+1 > 1 {
eps /= 2
}
eps *= 2
return eps
}
@kevyonan
kevyonan / boolcas.c
Last active November 26, 2024 21:13
boolean CAS in C
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <stdarg.h>
#define FOR(counter, limit) for( size_t counter = 0; counter < (limit); counter++ )
@kevyonan
kevyonan / llist.c
Last active August 6, 2024 02:32
a dumb linked list
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
struct Node {
struct Node *prev, *next;
int data;
};
#include <stdio.h>
#include <inttypes.h>
#include <time.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
static size_t bits_popcount(uint64_t const x) {
size_t count = 0;