Skip to content

Instantly share code, notes, and snippets.

Bob Miller kbob

  • Eugene, Oregon, USA
Block or report user

Report or block kbob

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kbob / voronoi.glsl
Created Jul 7, 2019
This fragment shader is just slightly too slow for an LED cube with Raspberry Pi 3 A+.
View voronoi.glsl
#!/usr/bin/env shaderbox
#define TAU 6.283185307179586
#define A vec3(0.5, 0.5, 0.5)
#define B vec3(0.5, 0.5, 0.5)
#define C vec3(1.0, 0.7, 0.4)
#define D vec3(0.0, 0.15, 0.20)
vec3 pal(in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d)
View blinky.v
`default_nettype none
module blinky (CLK, LED1);
input wire CLK;
output wire LED1;
parameter WIDTH = 24;
parameter CLK_HZ = 12_000_000;
reg [WIDTH-1:0] counter;
reg [7:0] led1;
kbob /
Created Dec 16, 2018
I fail to understand Rust types.
extern crate vulkano;
extern crate vulkano_shaders;
extern crate winit;
extern crate vulkano_win;
use vulkano::buffer::{CpuAccessibleBuffer, CpuBufferPool, BufferUsage};
use vulkano::command_buffer::{AutoCommandBufferBuilder, DynamicState};
use vulkano::descriptor::descriptor_set::PersistentDescriptorSet;
use vulkano::device::{Device, DeviceExtensions};
View icebreaker.pcf
# 12 MHz clock
set_io -nowarn CLK 35
# RS232
set_io -nowarn RX 6
set_io -nowarn TX 9
# LEDs and Button
set_io -nowarn BTN_N 10
set_io -nowarn LEDR_N 11
kbob / gist:3134a65680dd3e0e0015ed7ad423824d
Created Nov 18, 2018
Trying to instantiate a 2F PLL -- doesn't work.
View gist:3134a65680dd3e0e0015ed7ad423824d
`default_nettype none
`define W 24
module top (
input CLK,
output LED1,
output LED2,
output LED3,
output LED4,
View 16_swap_chain_recreation.cpp
// BEGIN kbob
// This is identical to
// as of 2018-06-13 except for code between the "BEGIN kbob" and "END kbob" comments.
// The original code is still there but commented out with "//-".
// Built with MoltenVK 1.1.73 and GLFW 20180519 for MacOS, the original never recreated
// the swap chain. It continued to draw at the original 800 by 600 resolution and scaled
// the result to fit the resized window.
// Also, according to GLFW doc, the glfwGetWindowSize() is not the right function to call.
View Hackaday_Top_Octave.ino
// Ask Hackaday: How do you DIY a Top-Octave Generator?
// Target Arduino Mega.
// N.B., Timer 1 has highest interrupt priority, so
// use it for the highest frequency oscillators.
// Note Comp Port/Pin Arduino Pin
// C OC1A PB5 pin 11
// B OC1B PB6 pin 12
kbob / dda2.c
Created Nov 2, 2016
Anti-aliasing, subpixel-positioned left edge DDA.
View dda2.c
#define EXPECT
#include <assert.h>
#include <math.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
kbob / print_nine_digit_positive.c
Created Jun 10, 2016
Silly unrolled print function
View print_nine_digit_positive.c
#include <assert.h>
#include <stdint.h>
#include <unistd.h>
/* print nine digit positive */
char *p9dp(uint32_t n, char *p)
uint32_t a = n % 10;
n /= 10;
if (n) {
kbob /
Created Feb 20, 2016
Trie insertion and query
struct TrieNode {
is_terminal: bool,
children: [Option<Box<TrieNode>>; 256],
impl TrieNode {
fn new() -> TrieNode {
let mem : TrieNode = unsafe { std::mem::zeroed() };
You can’t perform that action at this time.