Skip to content

Instantly share code, notes, and snippets.

View bcthomas's full-sized avatar

Brian Thomas bcthomas

View GitHub Profile
@bcthomas
bcthomas / MyMetalKernel.py
Created October 30, 2024 02:29 — forked from alvinwan/MyMetalKernel.py
How to write a minimal, standalone Python script to run Metal (GPU) kernels on Mac
"""
"Hello world" example of using Metal from Python.
This script can be run from the command line just like any other Python file. No
need for Xcode or any other IDE. Just make sure you have the latest version of
Python 3 installed, along with the PyObjC and pyobjc-framework-Metal packages.
"""
import Metal
import ctypes
@bcthomas
bcthomas / gist:1f16d1b5aacad6864d365695d839b241
Created August 20, 2016 20:51 — forked from alexdioso/gist:2439315
Display username and hostname in tmux window title
case "$TERM" in
screen)
export PROMPT_COMMAND='echo -ne "\033]2;${USER}@${HOSTNAME}: ${PWD}\007\033k${USER}@${HOSTNAME}\033\\"'
;;
esac
@bcthomas
bcthomas / DBSCAN.hpp
Last active August 29, 2015 14:18 — forked from ialhashim/DBSCAN.hpp
#pragma once
// Code adapted from https://github.com/propanoid/DBSCAN
#include <vector>
#include <algorithm>
#include <omp.h>
// Any basic vector/matrix library should also work
#include <Eigen/Core>