Skip to content

Instantly share code, notes, and snippets.

(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 / 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
@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.
;;; 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 / 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
@chebert
chebert / LICENSE-CC-BY-4.0.md
Created January 28, 2020 14:11
License for public Gists for Chebert.

LICENSE-CC-BY-4.0.md

UNLESS OTHERWISE NOTED, THE CONTENTS OF THESE PUBLIC GISTS ARE LICENSED UNDER THE CREATIVE COMMONS ATTRIBUTION 4.0 INTERNATIONAL LICENSE.

https://creativecommons.org/licenses/by/4.0/ Approved for Free Cultural Works

License Summary of CC-BY 4.0 International

This section is a human-readable summary of (and not a substitute for) the full license included below.

@chebert
chebert / pacman.c
Created June 30, 2018 18:19
Pacman in C using NCURSES
/*
map ,g :!clang -DDEBUG % -o %:r -lncurses && ./%:r <CR>
gcc pacman.c -o pacman -lncurses
./pacman
*/
/*
* TODO
* minor: ghosts should go all the way to their bottom positions (TILE_CENTER)
@chebert
chebert / freecell.c
Created June 30, 2018 18:01
Freecell in C using NCURSES
/*
map ,g :!gcc % -o %:r -lncurses && ./%:r <CR>
gcc freecell.c -o freecell -lncurses
./freecell
*/
#include <assert.h>
#include <stdint.h>
#include <ncurses.h>
@chebert
chebert / tetris.c
Created June 30, 2018 17:42
Tetris in C using NCURSES
/*
map <leader>g :!gcc % -o %:r -lncurses && ./%:r <CR>
gcc tetris.c -o tetris -lncurses
./tetris
*/
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
(defrecord machine-state
;; Registers
pc sp a b c d e f h l
;; Memory Regions
video-ram ext-ram work-ram sprite-ram mmap-i/o z-ram
;; Debug Fields
;; Lists of what the last instruction changed
affected-regs affected-flags memory-updates
;; The instruction that was just disassembled this step.