Skip to content

Instantly share code, notes, and snippets.

View cohnt's full-sized avatar

Thomas Cohn cohnt

View GitHub Profile
@cohnt
cohnt / parse.py
Created May 12, 2025 02:38
Filter Out Emails of People Who RSVPed Yes (Aisle Planner)
import csv
# File paths (change these if needed)
parties_file = 'parties.csv'
guests_file = 'guests.csv'
output_file = 'yes_rsvp_emails.txt'
# Step 1: Collect RSVP IDs for guests who RSVPed yes
yes_rsvp_ids = set()
@cohnt
cohnt / CMakeLists.txt
Created May 7, 2025 20:14
Binding `static constexpr` in Python
cmake_minimum_required(VERSION 3.14)
project(constexpr_demo)
# Enable C++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Find pybind11
find_package(pybind11 REQUIRED)
import numpy as np
import time
from pydrake.all import (
StartMeshcat,
RigidTransform,
RotationMatrix
)
meshcat = StartMeshcat()
@cohnt
cohnt / main.py
Last active September 17, 2024 17:37
Inertia Error
import os
from pydrake.all import (
StartMeshcat,
DiagramBuilder,
AddMultibodyPlantSceneGraph,
Parser,
LoadModelDirectivesFromString,
ProcessModelDirectives,
)
import numpy as np
import matplotlib.pyplot as plt
from sklearn.neighbors import kneighbors_graph
from collections import deque
def adj_mat_to_adj_list(adj_mat):
return [list(np.where(adj_mat[i] != 0)[0]) for i in range(adj_mat.shape[0])]
def edge_set_to_adj_mat(edge_set, n_points):
# Takes in a set of edges, and the number of points, and outputs an adjacency
@cohnt
cohnt / maze_new.py
Last active July 3, 2024 18:20
KinematicTrajectoryOptimization Non-Determinism
# In[2]:
import numpy as np
import os
import pydot
from IPython.display import display, Image, SVG
from tqdm import tqdm
@cohnt
cohnt / maze_new.py
Last active July 3, 2024 18:20
Box Box Problem Reproduction
# In[2]:
import numpy as np
import os
import pydot
from IPython.display import display, Image, SVG
from tqdm import tqdm
@cohnt
cohnt / A.npy
Last active June 11, 2024 20:28
Drake Affine Hull of HPolyhedron Check
This file has been truncated, but you can view the full file.
@cohnt
cohnt / box_small.urdf
Last active March 26, 2024 01:20
PointOnBoxSurfaceHelper Failure Reproduction
<?xml version="1.0"?>
<robot name="box_scene">
<material name="Blue">
<color rgba="0.0 0.0 0.8 1.0"/>
</material>
<material name="Red">
<color rgba="0.8 0.0 0.0 1.0"/>
</material>
<material name="Green">
@cohnt
cohnt / regions.pickle
Last active February 2, 2024 21:50
GcsTrajectoryOptimization Bug