Skip to content

Instantly share code, notes, and snippets.

View ehaliewicz's full-sized avatar

Erik Haliewicz ehaliewicz

View GitHub Profile
@ehaliewicz
ehaliewicz / 8queens.c
Created October 24, 2018 21:53
8queens
#include <stdio.h>
#include <stdint.h>
int columns[8] = {-1,-1,-1,-1,-1,-1,-1,-1};
int num_solutions = 0;
void print_queens() {
for(int y = 0; y < 8; y++) {
for(int x = 0; x < 8; x++) {
putchar(columns[x] == y ? 'Q' : '.');
@ehaliewicz
ehaliewicz / l.c
Created May 30, 2019 03:46
lambda
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum {
SUCCESS, // parsed
FAILURE, // didn't parse
ERROR // bad syntax
} status;
@ehaliewicz
ehaliewicz / calendar.go
Created March 31, 2021 18:27
calendar functions
func isLeap(y int) bool {
if y%4 == 0 {
if y%100 == 0 {
return y%400 == 0
}
return true
}
return false
}
@ehaliewicz
ehaliewicz / preg.c
Created June 8, 2024 18:46
reg thing
// no includes
typedef typeof(sizeof(0)) size_t;
#define NULL 0
int printf ( const char * format, ... );
void* memcpy(void *dest, const void * src, size_t n);
void exit(int);
<!DOCTYPE html>
<html>
<head></head>
<body>
<canvas id="canvas-id" style="image-rendering:pixelated;"></canvas>
<script type="text/javascript">
// triangles are