Skip to content

Instantly share code, notes, and snippets.

View pommicket's full-sized avatar

pommicket

View GitHub Profile
@pommicket
pommicket / scrabble-psx-starting-racks.txt
Created January 4, 2024 20:20
PSX Scrabble starting racks depending on which frame you press play
2850: REEQMBA
2851: ITDEUOI
2852: GK?UAAM
2853: SNDRAMO
2854: ZWILDAL
2855: ROTHHYC
2856: CILWAAH
2857: IO?ISST
2858: HTSOEIA
2859: EEHEINI
@pommicket
pommicket / argparser.h
Created September 22, 2023 20:28
tiny C argument parser
/*
tiny argument parser
accepts both - and -- prefixes (they are treated the same)
usage:
ArgParser parser = {.argc = argc, .argv = argv, .options_with_value = "output,foo"};
while (arg_parser_next(&parser)) {
if (!parser.option) {
printf("standalone argument %s\n", parser.value);
} else if (strcmp(parser.option, "output") == 0) {
printf("outputting to %s...\n", parser.value);
@pommicket
pommicket / generalized-mandelbrot.c
Last active July 29, 2020 20:23
the mandelbrot set, but with other functions instead of z^2+c
/*
the mandelbrot set, but with functions other than z^2 + c
requires stb_image_write.h (found here: https://github.com/nothings/stb)
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
@pommicket
pommicket / systemv64_call.asm
Last active May 8, 2020 17:59
Call functions using the SystemV AMD64 ABI (Linux, OS X, BSD) with a dynamic number of arguments
;;; Call SystemV x64 functions dynamically
;;; Written in NASM
;;; This implements the SystemV calling convention (which is used by Linux and OS X) so that
;;; you can call functions with a variable (i.e. not known at compile time) number of arguments.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is free and unencumbered software released into the public domain.
;;
;; Anyone is free to copy, modify, publish, use, compile, sell, or
;; distribute this software, either in source code form or as a compiled
;; binary, for any purpose, commercial or non-commercial, and by any
@pommicket
pommicket / win64_call.asm
Last active May 5, 2020 17:30
Call C functions with a dynamic number of arguments x64 MSVC
;;; Call C functions with a dynamic number of arguments x64 MSVC ;;;
;;; Written in NASM ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; This is free and unencumbered software released into the public domain.
;;
;; Anyone is free to copy, modify, publish, use, compile, sell, or
;; distribute this software, either in source code form or as a compiled
;; binary, for any purpose, commercial or non-commercial, and by any
;; means.
;;
@pommicket
pommicket / main.go
Created June 11, 2019 01:51
The WebAssembly version of AutoDistortion (https://github.com/pommicket/autodistortion)
/*
Copyright (C) 2019 Leo Tenenbaum
This file is part of AutoDistortion.
AutoDistortion is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
AutoDistortion is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@pommicket
pommicket / complex.min.js
Created October 16, 2016 21:02
Client side complex numbers in JavaScript.
/*
complex.js
Client-side complex numbers in JavaScript
Licensed under the GNU General Public License (https://pommicket.github.io/LICENSE.txt)
*/
var complex={};complex.i=[0,1];complex.logi=[0,.682188177];complex.PI=[Math.PI,0];complex.E=[Math.E,0];complex.lnAccuracy=20;complex.re=function(a){return a[0]};complex.im=function(a){return a[1]};complex.reToC=function(a){return[a,0]};complex.reC=function(a){return complex.reToC(complex.re(a))};complex.imC=function(a){return complex.reToC(complex.im(a))};complex.show=function(a){var im=complex.im(a);var re=complex.re(a);if(im==1&&re==0)return"i";if(im==0)return re.toString();if(im==1)return re+" + i";if(re==0)return im+"i";return re+" + "+im+"i"};complex.add=function(a,b){return[complex.re(a)+complex.re(b),complex.im(a)+complex.im(b)]};complex.neg=function(a){return[-complex.re(a),-complex.im(a)]};complex.sub=function(a,b){return complex.add(a,complex.neg(b))};complex.mult=function(a,b){var a_Re,a_Im,b_Re,b_Im;a_Re=complex.re(a);a_Im=complex.im(a);
@pommicket
pommicket / complex.js
Created October 16, 2016 20:54
Client-side complex numbers in JavaScript
/*
complex.js
Client-side complex numbers in JavaScript
Licensed under the GNU General Public License (https://pommicket.github.io/LICENSE.txt)
*/
var complex = {};
complex.i = [0, 1];
complex.logi = [0, 0.682188177];
complex.PI = [Math.PI, 0];