Skip to content

Instantly share code, notes, and snippets.

View kvablack's full-sized avatar

Kevin Black kvablack

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kevin3-black on github.
  • I am kevin3black (https://keybase.io/kevin3black) on keybase.
  • I have a public key ASCEuZM7oJ2HB33vD85QshGAaUGtGVXo8Y1dneCNzZaqHAo

To claim this, I am signing this object:

#include <Servo.h>
#define distance 9.42038797 //in meters, determines time
#define MotorPort 9
#define FORWARD 101 //speed
#define COAST 90
#define extraTime 1 //in seconds so the car drives longer than necessary
//#define driveTime 4000
Servo motor;
/*
* Copyright (c) 2015,
* National Instruments Corporation.
* All rights reserved.
*/
#include <stdio.h>
#include <time.h>
#include "MyRio.h"
@kvablack
kvablack / b4.out
Last active February 21, 2019 00:29
instruction: d2bf6860, PC: 4000d4
X00 : fffffffffb430000
X01 : 0000000000000000
X02 : 0000000000000000
X03 : 0000000000000000
X04 : 0000000000000000
X05 : 0000000000000000
X06 : 0000000000000000
X07 : 0000000000000000
X08 : 0000000000000000
@kvablack
kvablack / bobfs.cc
Created November 11, 2019 22:14
My BobFS
#include "bobfs.h"
#include "libk.h"
#include "debug.h"
#include "machine.h"
uint8_t zero_1024[BobFS::BLOCK_SIZE];
Semaphore BobFS::lock{0};
BobFS* BobFS::cache[4];
void bobFSInit() {
@kvablack
kvablack / dump_graph.py
Created October 5, 2020 21:16
Tensorflow 2 code to dump a SavedModel graph to Tensorboard format as well as text format
import tensorflow as tf
import sys
if __name__ == '__main__':
graph = tf.saved_model.load(sys.argv[1]).signatures['serving_default'].graph
with graph.as_default():
writer = tf.compat.v1.summary.FileWriter(sys.argv[2])
writer.add_graph(graph)
writer.close()
tf.io.write_graph(graph.as_graph_def(), sys.argv[2], "graph.pbtxt")
@kvablack
kvablack / render.py
Created July 7, 2023 20:56
DDPO animation using iceberg
from iceberg import Renderer, Bounds, Colors, PathStyle, Corner, FontStyle, Color, StrokeCap
from iceberg.primitives.layout import Directions, Anchor, Compose, Arrange, Align
from iceberg.arrows import Arrow, ArrowHeadStyle
from iceberg.primitives import Blank, Image, Ellipse, Text, Rectangle, BorderPosition, MathTex
import imageio
import numpy as np
from PIL import Image as PImage
from IPython.display import Video
from tqdm.notebook import tqdm
import numpy as np
from functools import partial
import jax.numpy as jnp
import jax
from jax.experimental.shard_map import shard_map
from jax.experimental import mesh_utils
from jax.sharding import NamedSharding, PartitionSpec
from jax.experimental.compilation_cache import compilation_cache
import tqdm