Skip to content

Instantly share code, notes, and snippets.

View jeandrek's full-sized avatar

Jeandre jeandrek

View GitHub Profile
@jeandrek
jeandrek / io.scm
Created June 5, 2018 02:36
Haskell I/O monad in Scheme
;;;; Monads
(define (return x) (make-result x))
(define (bind m k)
(make-thunk (lambda () (execute! (k (execute! m))))))
(define (execute! m)
(cond ((result? m) (result-value m))
((thunk? m) (execute-thunk! m))))
.text
.globl _main
_main:
call ___djgpp_nearptr_enable
testl %eax, %eax
jz err
movw $0x13, %ax
int $0x10
movl $0xa0000, %ebx
subl ___djgpp_base_address, %ebx
@jeandrek
jeandrek / Makefile
Last active January 20, 2022 00:51
Scratch RISC-V subset emulator programs
AS=riscv32-elf-as
CC=riscv32-elf-gcc
LD=riscv32-elf-ld
OBJCOPY=riscv32-elf-objcopy
LDFLAGS=-T riscv.ld
ASFLAGS=-march=rv32imfd
CFLAGS=$(ASFLAGS) -O2
.SUFFIXES: .s .S .txt
f = open('dog.obj','r')
verts = []
uvs = []
normals = []
faces = []
for line in f:
if line[:2] == 'v ':
verts.append(tuple(map(lambda s:float(s),line.split()[1:])))
/*
* compile with DJGPP
*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <pc.h>
void
  • Rainbow of our Departure
    • Pokemon -- I Choose You! (Episode 1), end
    • Fight for the Light, end
    • Fly Me to the Moon, 16:45
    • Get the Show on the Road (AG episode 1), 18:21
  • Spearow's Attack
    • Pokemon -- I Choose You! (Episode 1)
    • Very frequent
  • ??? Familiar; chimes, strings
  • Fly Me to the Moon, 15:30
@jeandrek
jeandrek / display-fancy.c
Created May 13, 2026 05:26
For piping program output
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
int c;
for (;;) {
c = getchar();
if (c == -1) return 0;