Skip to content

Instantly share code, notes, and snippets.

View jhurliman's full-sized avatar
🐨

John Hurliman jhurliman

🐨
View GitHub Profile
@jhurliman
jhurliman / killgpu.sh
Created May 4, 2023 03:53
Shell alias to kill all processes using the GPU. Only for headless NVIDIA GPU machines!
alias killgpu='nvidia-smi --query-compute-apps=pid --format=csv,noheader | xargs --no-run-if-empty sudo kill'
@jhurliman
jhurliman / rosbag2-benchmark-humble-nano2gb.csv
Created October 4, 2022 20:32
rosbag2 benchmark results - ROS2 Humble on NVIDIA Jetson Nano 2GB
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 9 columns, instead of 5 in line 7.
messages,batch_size,plugin_config,name,avg_byte_throughput,max_arena_size,max_in_use_size,max_mmap_size,close_time
large,small,mcap_default,messages=large;batch_size=small;plugin_config=mcap_default,360230333.3234964,999424,1677968,1007616,0.000673866
large,small,mcap_nocrc,messages=large;batch_size=small;plugin_config=mcap_nocrc,360378541.6077541,1003520,1677456,1007616,0.000643136
large,small,mcap_zstd,messages=large;batch_size=small;plugin_config=mcap_zstd,359844528.64106107,999424,1677280,1007616,0.000597093
large,small,mcap_nochunking,messages=large;batch_size=small;plugin_config=mcap_nochunking,360667650.147003,999424,1677280,1007616,0.00059126
large,small,sqlite_default,messages=large;batch_size=small;plugin_config=sqlite_default,335139326.56812894,1134592,2165904,0,0.000458133
large,small,sqlite_resilient,messages=large;batch_size=small;plugin_config=sqlite_resilient,223319138.0299207,1134592,2161408,0,0.00205389
large,medium,mcap_default,messages=large;batch_size=medium;plugin_config=mcap_default,359
@jhurliman
jhurliman / rosbag2-benchmark-humble-tx2.csv
Created October 4, 2022 07:02
rosbag2 benchmark results - ROS2 Humble on NVIDIA Jetson TX2
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 9 columns, instead of 4 in line 7.
messages,batch_size,plugin_config,name,avg_byte_throughput,max_arena_size,max_in_use_size,max_mmap_size,close_time
large,small,mcap_default,messages=large;batch_size=small;plugin_config=mcap_default,198406545.84777477,999424,1896784,1007616,0.001389235
large,small,mcap_nocrc,messages=large;batch_size=small;plugin_config=mcap_nocrc,198753701.76083803,999424,1895968,1007616,0.00135346
large,small,mcap_zstd,messages=large;batch_size=small;plugin_config=mcap_zstd,196985836.29268298,999424,1896112,1007616,0.001433238
large,small,mcap_nochunking,messages=large;batch_size=small;plugin_config=mcap_nochunking,195853825.78654373,999424,1896112,1007616,0.001555497
large,small,sqlite_default,messages=large;batch_size=small;plugin_config=sqlite_default,232529684.43262097,1409024,2166544,0,0.000428092
large,small,sqlite_resilient,messages=large;batch_size=small;plugin_config=sqlite_resilient,169399347.25798884,1404928,2161056,0,0.004874539
large,medium,mcap_default,messages=large;batch_size=medium;plugin_config=mcap_defaul
@jhurliman
jhurliman / WebGLCompute.ts
Created October 4, 2022 01:12
WebGL2 compute shaders using transform feedback
/**
* Matches against GLSL shader outputs.
*/
const VARYING_REGEX = /[^\w](?:varying|out)\s+\w+\s+(\w+)\s*;/g
/**
* Adds line numbers to a string with an optional starting offset.
*/
const lineNumbers = (source: string, offset = 0): string => source.replace(/^/gm, () => `${offset++}:`)
@jhurliman
jhurliman / LruCache.ts
Created September 28, 2022 20:55
LRU cache in TypeScript
class LruCache<T> {
private values = new Map<string, T>();
constructor(private maxEntries = 10) {}
public get(key: string): T | undefined {
const entry = this.values.get(key);
if (entry != undefined) {
this.values.delete(key);
this.values.set(key, entry);
@jhurliman
jhurliman / ros2-galactic-src.Dockerfile
Created September 13, 2022 16:51
Build ROS2 Galactic from source in an Ubuntu 20.04 container
FROM ubuntu:focal
ARG USER=jhurliman
ARG BASE_DIR=/home/$USER/Documents/Code/ros2/ros2_galactic
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y locales
RUN locale-gen en_US en_US.UTF-8
@jhurliman
jhurliman / SettingsManager.ts
Last active June 16, 2022 19:29
Foxglove Studio high-level settings API
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
import { produce } from "immer";
import {
SettingsTreeAction,
SettingsTreeNode,
SettingsTreeRoots,
@jhurliman
jhurliman / Dockerfile
Last active May 9, 2022 23:20
Build depthai-ros from source (OAK-D Luxonis DepthAI)
FROM ros:noetic-ros-core-focal
# Install dependencies for depthai, ros, and build
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
git \
libjpeg-dev \
libopencv-dev \
libpng-dev \
@jhurliman
jhurliman / IndexedInstancedMesh.ts
Created March 17, 2022 00:44
Extends THREE.js InstancedMesh with the ability to reference instances by a string key and add/remove instances with dynamic buffer resizing
import * as THREE from "three";
type UserData = { [key: string]: unknown };
const INITIAL_SIZE = 4;
const tempMat4 = new THREE.Matrix4();
const tempColor = new THREE.Color();
/**
@jhurliman
jhurliman / ros2-topic-pub-examples.sh
Created March 7, 2022 22:37
ros2 topic pub examples
# volatile, no history
ros2 topic pub -r 0.5 --qos-durability volatile --qos-reliability reliable /chatter std_msgs/msg/String '{data: hello}'
# transient_local, history of 5
ros2 topic pub -r 0.5 --qos-durability transient_local --qos-reliability reliable --qos-depth 5 --qos-history keep_last /chatter std_msgs/msg/String '{data: hello}'
# foxy compatible transient_local
ros2 topic pub -r 0.5 --qos-durability transient_local --qos-reliability reliable /chatter std_msgs/msg/String '{data: hello}'
# /tf_static