Skip to content

Instantly share code, notes, and snippets.

View prideout's full-sized avatar
🎯
Focusing

Philip Rideout prideout

🎯
Focusing
View GitHub Profile
@prideout
prideout / togray.py
Created December 2, 2015 22:25
Python script that extracts red from 3 BPP image and saves as 1 BPP image.
from PIL import Image
im = Image.open("color.png")
im.split()[0].save("gray.png")
@prideout
prideout / dynamic_array.c
Last active January 16, 2016 18:17
dynamic array of uint16_t in C
#define PAR_CALLOC(T, N) ((T*) calloc(N * sizeof(T), 1))
#define PAR_REALLOC(T, BUF, N) ((T*) realloc(BUF, sizeof(T) * N))
#define PAR_FREE(BUF) free(BUF)
typedef struct {
uint16_t* values;
size_t count;
size_t capacity;
} par__uint16list;
@prideout
prideout / gist:c962b47e5b8e3e4790e0
Created January 19, 2016 04:09
paste-to-console flatbuffers test for Python serialization
cd tests
cat > wombat.fbs <<EOF
namespace Fauna;
struct Foo { x:short; }
table Wombat { foos:[Foo]; }
EOF
../flatc -p wombat.fbs
cat > wombat.py <<EOF
import flatbuffers, binascii
from Fauna import Wombat, Foo
@prideout
prideout / break.py
Created January 29, 2016 01:59
Break to Python interpreter
import code; code.interact(local=locals())
@prideout
prideout / gist:cd3a3dd2ac10171b12e8
Created March 9, 2016 21:19
break on throw in LLDB
break set -E c++
@prideout
prideout / tutorial.js
Last active October 11, 2018 23:28
FilamentJS prototype example
class App {
constructor() {
this.canvas = document.getElementsByTagName('canvas')[0]
this.render = this.render.bind(this);
this.resize = this.resize.bind(this);
const TRIANGLE_POSITIONS = Filament.BufferDescriptor(new Float32Array([
1, 0,
@prideout
prideout / servewasm.py
Created November 8, 2018 00:44
Python WASM server
#!/usr/bin/env python3
import http.server
import socketserver
PORT = 8000
Handler = http.server.SimpleHTTPRequestHandler
Handler.extensions_map.update({
'.wasm': 'application/wasm',
@prideout
prideout / before_dce.glsl
Last active November 13, 2018 16:44
Before_DCE
#version 310 es
// glslc -std=310es -fshader-stage=vertex before_dce.glsl
// spirv-opt -Os a.spv -o b.spv
// spirv-cross b.spv
invariant gl_Position;
uniform FrameUniforms {
mat4 clipFromWorldMatrix;
@prideout
prideout / color.vert
Created November 14, 2018 18:15
depth pass and color pass
#version 310 es
#define TARGET_MOBILE
precision highp float;
precision highp int;
invariant gl_Position;
#if defined(TARGET_MOBILE)
#define HIGHP highp