Skip to content

Instantly share code, notes, and snippets.

@floooh
floooh / c64.sh
Created November 21, 2019 14:10
encode C64 PRG file in URL and open in browser
#!/bin/sh
#
# usage on Mac (assuming 'chmod u+x c64.sh'):
#
# ./c64.sh [PRG filename]
#
open $(base64 $1 | php -r "echo 'https://floooh.github.com/tiny8bit/c64.html?prg='.urlencode(fgets(STDIN));")
@floooh
floooh / c64url.sh
Created November 21, 2019 13:54
Bash one liner to encode C64 PRG file into URL.
#
# c64url.sh
#
# on Mac run this to encode a PRG file into a URL and copy URL into clipboard:
#
# sh c64url.sh [PRG filename] | pbcopy
#
base64 $1 | php -r "echo 'https://floooh.github.com/tiny8bit/c64.html?prg='.urlencode(fgets(STDIN));"
@floooh
floooh / 3dapi_pixelformats.md
Last active September 8, 2021 13:05
3D API pixel formats
@floooh
floooh / ring.h
Last active June 20, 2019 04:11
simple circular-queue / ringbuffer in C
#define MAX_SLOTS (256)
typedef struct {
uint32_t head; // next slot to enqeue
uint32_t tail; // next slot to dequeue
uint32_t num; // number of slots in ring buffer (plus 1 for empty/full detection)
uint32_t buf[MAX_SLOTS]; // items could be index-handles
} ring_t;
// wrapped index into buf (private helper)
@floooh
floooh / cubemaprt.glsl
Last active May 1, 2019 12:48
Sokol shader-code-genenerator example
//------------------------------------------------------------------------------
// shaders for cubemaprt-sapp sample
//------------------------------------------------------------------------------
@ctype mat4 hmm_mat4
@ctype vec4 hmm_vec4
// same vertex shader for offscreen- and default-pass
@vs vs
uniform shape_uniforms {
mat4 mvp; // model-view-projection matrix
sg_shader shd = sg_make_shader(&(sg_shader_desc){
.attrs = {
[0] = { .sem_name="POS", .sem_index=0 },
[1] = { .sem_name="COLOR", .sem_index=0 }
},
.vs.source = ...
"struct vs_in {\n"
" float4 pos: POS;\n"
" float4 color: COLOR;\n"
"};\n"
cmdline:
sokol-shdc --input /Users/floh/projects/sokol-tools/test/test1.glsl --output bla.h --slang hlsl5:glsl330 --errfmt gcc --dump
output:
args_t:
valid: true
exit_code: 0
input: '/Users/floh/projects/sokol-tools/test/test1.glsl'
if(typeof process!=="undefined"){var Module={};}// Copyright 2010 The Emscripten Authors. All rights reserved.
// Emscripten is available under two separate licenses, the MIT license and the
// University of Illinois/NCSA Open Source License. Both these licenses can be
// found in the LICENSE file.
var Module = Module;
var ENVIRONMENT_IS_NODE = typeof process === 'object';
if (ENVIRONMENT_IS_NODE) {
var fs = require('fs');
---
layout: post
title: "Bla"
---
Bla bla bla bla.
<script type="text/javascript">
function start_emu() {
if (!document.getElementById('emu')) {