Skip to content

Instantly share code, notes, and snippets.

View ryansturmer's full-sized avatar

Ryan Sturmer ryansturmer

View GitHub Profile
@ryansturmer
ryansturmer / monty2.py
Created January 18, 2021 04:43
Monty Hall Problem
# Monty Hall Problem Simulation
# Author: Ryan Sturmer
#
import random
def play_round(doors, switch):
# Choose the location of the car
car = random.randint(1, doors)
@ryansturmer
ryansturmer / archinstall.sh
Last active July 18, 2019 14:31
Script for Building a Beaglebone Black Archlinux ARM system with JupyterLab.
#!/bin/bash
TMPDIR=.tmp
DEVICE=/dev/mmcblk1
CURDIR=`pwd`
PARTITION=$DEVICE"p1"
PACKAGES="\
base-devel git vim \
nodejs npm \
jupyter jupyter-notebook jupyterlab python2-ipykernel python-numpy python-scipy python-pandas python-requests \
{
"records": [
{
"t": 0,
"ch": "C",
"dir": "out",
"data": "\u0004"
},
{
"t": 1,
@ryansturmer
ryansturmer / fabmo-dev.sh
Last active December 3, 2016 23:24
Convert a binary installation to a development one on an intel edison.
systemctl stop fabmo fabmo-updater
cd /fabmo
mount -w -o remount /
rm -rf engine updater
git clone https://github.com/FabMo/FabMo-Engine.git ./engine
git clone https://github.com/FabMo/FabMo-Updater.git ./updater
cd /fabmo/updater
npm install
touch install_token
@ryansturmer
ryansturmer / miter_panels.py
Created November 3, 2016 03:46
Functions for generating G-Code for mitered box panels
from math import cos, sin, tan, atan2, atan, pi
def gx(n, x=None,y=None,z=None, f=None):
retval = ['G%d' % n]
for a,b in zip(('X','Y','Z','F'), (x, y, z, f)):
if b is not None:
if a == 'F':
b *= 60.0 # Feedrates in ipm not ips
retval.append(' %s%0.4f' % (a,b))
return ''.join(retval)
@ryansturmer
ryansturmer / paint.py
Created October 15, 2016 03:34
Convert @PrimitivePic output to g-code for painting (quadratic bezier curves only)
import xml.etree.ElementTree as ET
import sys
import math
import re
import argparse
import os
def gx(n, x=None,y=None,z=None, f=None):
retval = ['G%d' % n]
for a,b in zip(('X','Y','Z','F'), (x, y, z, f)):
@ryansturmer
ryansturmer / friction-joint.js
Last active August 20, 2016 04:05
Locking joint
function getParameterDefinitions() {
return [
{ name: 'detents', type: 'int', initial: 12, caption: "Detents" },
{ name: 'holeDiameter', type: 'float', initial: 0.25, caption: "Bolt Diameter" }
];
}
function main(params) {
var holeDiameter = params.holeDiameter;
var detents = params.detents;
@ryansturmer
ryansturmer / back.stl
Created August 13, 2016 02:17
Chair Back
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ryansturmer
ryansturmer / baby-chair.js
Last active August 17, 2016 16:33
Parametric Baby Chair
// Walter's Chair
var woodColor = [0.93,0.83,0.67];
function getParameterDefinitions() {
return [
{ name: 'seatDepth', type: 'float', initial: 12, caption: "Seat Depth" },
{ name: 'seatWidth', type: 'float', initial: 12, caption: "Seat Width" },
{ name: 'chairHeight', type: 'float', initial: 12, caption: "Chair Height" },
{ name: 'seatHeight', type: 'float', initial: 7, caption: "Seat Height" },
@ryansturmer
ryansturmer / install_fabmo.sh
Last active December 18, 2015 17:51
Clean install of the FabMo Engine for the Intel Edison
#!/bin/sh -vex
# To run as one-liner:
# wget https://goo.gl/JfLl3S -v -O fabmo_install.sh && chmod u+x ./fabmo_install.sh && ./fabmo_install.sh
# Stop running instances of the engine and updater
systemctl stop fabmo
systemctl stop fabmo-updater
# Clear out old installations
rm -rf /fabmo /opt/fabmo