Skip to content

Instantly share code, notes, and snippets.

Foam Extension Development Quick Start Guide

For OSX, tested on my computer on a monday. YMMV. I started without any node/etc installed.

I never got NVM to work for node versioning, so I defaulted to just using brew node:

	brew install node

And then install yarn and lerna globally:

@machinaut
machinaut / Makefile
Created July 26, 2021 23:08
Trying a bare cuda vector add against pytorch and triton
CUDA_PATH ?= /usr/local/cuda
.PHONY: clean
vadd.so: vadd.o
nvcc -shared $^ -o $@ -lcuda
vadd.o: vadd.cu
nvcc -I $(CUDA_PATH)/include -I$(CUDA_PATH)/samples/common/inc -arch=sm_70 --compiler-options '-fPIC' $^ -c $@
@machinaut
machinaut / sketch.ino
Created October 21, 2020 19:14
air sensor
/**
BasicHTTPClient.ino
Created on: 24.05.2015
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
@machinaut
machinaut / material.py
Created February 28, 2019 03:14
Tensegrity Material Analysis
#!/usr/bin/env python
import numpy as np
'''
Notes:
- Tensile strength of 7x19 1/4" galvanized steel wire rope ~ 7000 lbs
'''
@machinaut
machinaut / geom.py
Created February 28, 2019 03:06
Tensegrity Geometry
#!/usr/bin/env python
import numpy as np
from collections import OrderedDict
from scipy.optimize import LinearConstraint, minimize, BFGS
def normlen(v):
''' length of norm of a vector '''
return np.sqrt(np.sum(np.square(v)))
@machinaut
machinaut / prarie.py
Created December 7, 2018 22:42
Prarie Riddler
#!/usr/bin/env python
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import minimize
'''
Parameterize a solution space so all numbers are valid:
Solver coordinates are given as arctanh(radius), theta
Then minimize the inverse average distance (to maximize average distance).
@machinaut
machinaut / umbrellas.py
Created December 7, 2018 21:59
Umbrellas Riddler
#!/usr/bin/env python
from itertools import product
PROB_MORNING_RAIN = .5
PROB_EVENING_RAIN = .4
# Enumerate all possible cases, and sum the probability of getting rained on
total_probability = 0 # Total probability of getting rained on
@machinaut
machinaut / contacts.py
Last active September 2, 2022 08:52
example reading out mujoco contacts
#!/usr/bin/env python
import os
import mujoco_py
import numpy as np
PATH_TO_HUMANOID_XML = os.path.expanduser('~/.mujoco/mjpro150/model/humanoid.xml')
# Load the model and make a simulator
model = mujoco_py.load_model_from_path(PATH_TO_HUMANOID_XML)
@machinaut
machinaut / Dockerfile
Created October 26, 2018 00:08
Demonstrating installing mujoco-py and gym[mujoco] on ubuntu 18.04
FROM ubuntu:18.04
# Install python and utils
RUN apt-get update && apt-get install -y python3-pip curl unzip \
libosmesa-dev libglew-dev patchelf libglfw3-dev
# Download mujoco
RUN curl https://www.roboti.us/download/mjpro150_linux.zip --output /tmp/mujoco.zip && \
mkdir -p /root/.mujoco && \
unzip /tmp/mujoco.zip -d /root/.mujoco && \
@machinaut
machinaut / mean_estimator.py
Created May 10, 2018 18:04
MeanTeacher in a custom TF estimator
#!/usr/bin/env python
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software