Skip to content

Instantly share code, notes, and snippets.

View misterhat's full-sized avatar
💭
🐸 🐸

zorian misterhat

💭
🐸 🐸
  • winnipeg, mb
  • 03:55 (UTC -05:00)
View GitHub Profile
#!/usr/bin/env node
const fetch = require('node-fetch-commonjs');
const path = require('path');
const readline = require('readline/promises');
const { spawn } = require('child_process');
const { promises: fs } = require('fs');
const { stdin, stdout } = require('process');
const concat = require('concat-stream');
@misterhat
misterhat / generate-offsets.js
Last active December 4, 2022 19:47
/devkitpro/examples/3ds/graphics/gpu/textured_cube/ modified to dump framebuffer to ppm file
const drawIndex = 0;
const yOffsets = [1, 4, 5, 16, 17, 20, 21, 64];
const xOffsets = [2, 8, 10, 32, 34, 40, 42, 1920];
const expandedYOffsets = [0];
let test = 0;
for (let i = 0; i < 30; i++) {
@misterhat
misterhat / tinysoundfont-pcm.c
Created April 12, 2022 14:14
dump a MIDI to PCM with tinysoundfont
#include <stdint.h>
#include <stdio.h>
#define TSF_IMPLEMENTATION
#include "tsf.h"
#define TML_IMPLEMENTATION
#include "tml.h"
#define SAMPLE_RATE 22050
@misterhat
misterhat / sdl-audio.c
Last active July 9, 2021 21:35
play 8 bit unsigned PCM audio in SDL with C
#include <emscripten.h>
#include <SDL2/SDL.h>
#include <stdint.h>
#include <stdio.h>
#define BUFFER_SIZE 4096
int main(int argc, char **argv) {
if (SDL_Init(SDL_INIT_AUDIO)) {
@misterhat
misterhat / .vimrc
Last active September 18, 2024 07:23
call plug#begin()
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'maxmellon/vim-jsx-pretty'
Plug 'tpope/vim-surround'
call plug#end()
" Add syntax highlighting.
syntax on
[Scheme]
Name=evilroot
ColorPalette=#1B1D1E;#ff005f;#afd700;#ff8f00;#0d4eb5;#8C54FE;#4c8ea1;#d2d2d2;#505354;#ff6767;#8ce25d;#ffb445;#5496ff;#9E6FFE;#6bc1d0;#ffffff
ColorForeground=#f8f8f2
ColorCursor=#f8f8f2
ColorBackground=#000000
URxvt.scrollBar: false
URxvt.cursorBlink: true
URxvt.perl-ext: default,matcher
URxvt.url-launcher: sensible-browser
URxvt.keysym.C-Delete: perl:matcher:last
URxvt.keysym.M-Delete: perl:matcher:list
URxvt.matcher.button: 1
URxvt.font: xft:Inconsolata:pixelsize=15,xft:Symbola
URxvt.letterSpace: -1
set padding 0 0 0 0
set border 0
set bargravity n
set barborder 1
alias syncboard exec sh -c 'xclip -o | xclip -selection clipboard'
alias screenshot exec sh -c 'cd ~/Pictures/screenshots; scrot -s'
alias volume exec volume="$(ratpoison -c prompt\ volume:\ )%"; pacmd list-sinks | awk -F ': ' '/index/ {print $2}' | xargs -I{} pactl set-sink-volume {} $volume
(function () {
var module = {};
// maps
var LOBBY = [
[ 1, 1, 1, 1, 1, 1, 1, 1 ],
[ 1, 0, 0, 0, 1, 0, 0, 1 ],
[ 1, 0, 0, 0, 1, 0, 0, 1 ],
[ 1, 0, 0, 0, 1, 0, 0, 1 ],
[ 1, 0, 0, 0, 1, 1, 0, 1 ],
var GridPaint = require('gridpaint');
var painter = new GridPaint({ width: 26, height: 15, cellWidth: 16 }),
d, actions;
document.body.appendChild(painter.dom);
d = document.createElement('div');
d.style.marginBottom = '6px';
painter.palette.forEach(function (colour, i) {