Skip to content

Instantly share code, notes, and snippets.

View assyrianic's full-sized avatar
💻
CompEng courses

Kevin Yonan assyrianic

💻
CompEng courses
View GitHub Profile
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <inttypes.h>
struct Rational {
ssize_t numerator;
size_t denominator;
};
@assyrianic
assyrianic / gaussian.c
Created November 13, 2024 21:18
testing gaussian elimination to solve system of equations.
#include <stdio.h>
#include <math.h>
void gaussian(size_t const n, double A[n][n], double v[const restrict]) {
for( size_t k = 0; k < n-1; k++ ) {
/// Partial pivot
double cur_max = fabs(A[k][k]);
size_t m = k;
for( size_t i = k+1; i < n; i++ ) {
double const potential_max = fabs(A[i][k]);
@assyrianic
assyrianic / 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++ ) {
@assyrianic
assyrianic / 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
}
@assyrianic
assyrianic / 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++ )
@assyrianic
assyrianic / 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>
enum CardSuit {
SUIT_HEART,
SUIT_DIAMOND,
SUIT_SPADE,
@assyrianic
assyrianic / derivative_estimator.py
Last active August 27, 2024 07:02
a python script for estimating derivatives from a table of inputs and outputs.
# derivative estimator.
cont = True
while cont:
xs, ys = [], []
while True:
a = input('enter X: ')
if len(a) < 1:
break
xs.append(float(a))
stock void RunScript(const char[] sCode, any ...) {
/**
* Run a VScript (Credit to Timocop)
*
* @param sCode Magic
* @return void
*/
static int iScriptLogic = INVALID_ENT_REFERENCE;
if( iScriptLogic==INVALID_ENT_REFERENCE || !IsValidEntity(iScriptLogic) ) {
@assyrianic
assyrianic / FDR.ino
Last active March 21, 2024 03:49
Flight Data Recorder arduino code for the Glendale Community College [Arizona] course ECE294 aka NASA ASCEND Project.
#include <Fdr.h>//was Fdr.h
Fdr fdr; //I am defining fdr as type Fdr.
#include <Wire.h>
/**************************************
Modems
***************************************
The near modem is the one in the payload. The far modem is who we are talking with via satellite.
***************************************