Skip to content

Instantly share code, notes, and snippets.

@binaryfoundry
binaryfoundry / fizzbuzz.py
Created January 30, 2018 15:18
Port of Joel Grus Fizz Buzz in Tensorflow to Keras
from keras.models import Sequential
from keras.layers import Dense
import numpy as np
np.random.seed(7)
NUM_DIGITS = 12
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
@binaryfoundry
binaryfoundry / ShaderLabPBR.shader
Last active September 29, 2024 15:32
Unity PBR Shader
Shader "CustomPBRShader"
{
Properties
{
[NoScaleOffset] _Albedo("Albedo", Color) = (1.0, 1.0, 1.0, 1.0)
[NoScaleOffset] _Metalness("Conductivity", Range(0.0, 1.0)) = 0.0
[NoScaleOffset] _Roughness("Roughness", Range(0.0, 1.0)) = 0.0
[NoScaleOffset][HDR] _RadianceMap("RadianceMap", CUBE) = "" {}
[NoScaleOffset][HDR] _IrradianceMap("IrradianceMap", CUBE) = "" {}
}
@binaryfoundry
binaryfoundry / wavelets.js
Last active April 25, 2020 17:45
Haar Wavelets
// http://bearcave.com/misl/misl_tech/wavelets/index.html
class WaveletBase {
constructor() {
this.forward = 1;
this.inverse = 2;
}
split(vec, N) {
var half = N >> 1;
var vc = vec.slice();
#pragma once
#include <stdint.h>
#include <string.h>
#define WAVELET_DIM 512
extern void wavelet_forward_2d(uint8_t *mat, size_t N);
extern void wavelet_inverse_2d(uint8_t *mat, size_t N);
//The MIT License
//Copyright (c) 2019-2020, blockulator.
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions: