Skip to content

Instantly share code, notes, and snippets.

@chebert
chebert / base_test.cpp
Last active May 5, 2020 16:20
Focused recreation of problem I'm encountering with using OpenGL versions >3.1 on my laptop
/* Folder structure
workspace
|- build.bat -- listing below
|- Glew dlls
|- SDL2 dlls
|- include\
|- SDL2\ -- SDL2 header files
|- GL\ -- Glew header files
|- lib\
|- Glew libs
;;; Slime/Swank Setup
(defun multiline? (string)
"True if the string has multiple lines."
(position ?\n string))
(defun multiline-comment (string)
"Return string formatted as a multi-line Lisp comment"
(concat "#||\n" string "\n||#\n"))
@chebert
chebert / run_pipe_server.c
Last active May 22, 2022 15:04
Full RunPipeServer.c implementation
#include "run_pipe_server.h"
#include <windows.h>
#include <stdio.h>
// Create a named pipe with the given pipe_filename.
static Pipe CreateServerPipe(String pipe_filename);
// Wait for a client connection to pipe.
static b4 ConnectPipe(Pipe);
// Loop that processes and responds to client requests from Pipe, until the client disconnects.
@chebert
chebert / run_pipe_server.h
Created May 22, 2022 15:05
RunPipeServer header
#ifndef RUN_PIPE_SERVER_H
#define RUN_PIPE_SERVER_H
#include <stdint.h>
#ifndef REQUEST_BUFFER_SIZE
#define REQUEST_BUFFER_SIZE (1024*1024*128)
#endif
#ifndef RESPONSE_BUFFER_SIZE
(cl:defpackage #:pipe-client
(:use #:cl))
(in-package #:pipe-client)
;;; Create/Close pipe
(defun create-pipe-client! (pipe-filename)
"Creates a pipe-client with the given pipe-filename.
Returns a valid pipe handle or signals an error.
Assumes a pipe-server is already open with the same pipe-filname."
@chebert
chebert / advent-of-code-day16.lisp
Created February 1, 2025 18:34
A buggy implementation of a solution for Advent of Code Day 16 2024
(in-package #:cl-user)
;;; Parsing the grid
(defun read-char! (in k-char k-eos)
"Returns (k-char char). If end of stream returns (k-eos)"
(let ((char (read-char in nil nil)))
(cond
(char (funcall k-char char))
(t (funcall k-eos)))))