Skip to content

Instantly share code, notes, and snippets.

View ryansturmer's full-sized avatar

Ryan Sturmer ryansturmer

View GitHub Profile
@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
{
"records": [
{
"t": 0,
"ch": "C",
"dir": "out",
"data": "\u0004"
},
{
"t": 1,
@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 \
@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 / review_1_uart.c
Created October 25, 2024 12:22
Embedded C Code Review Example 1 - UART Command Prompt
#include <stdint.h>
#include <string.h>
#define UART_RX_BUFFER_SIZE 64
#define COMMAND_BUFFER_SIZE 32
// Pseudo HAL for UART - definitions elsewhere
void UART_SendString(char *str);
void UART_ReceiveInterruptEnable(void);
void UART_ReceiveInterruptDisable(void);
@ryansturmer
ryansturmer / review_2_bms.c
Last active December 4, 2024 13:54
Embedded C Code Review Example 2 - Reading a Battery Fuel Gauge
#include <stdint.h>
#include <stdbool.h>
#define COULOMB_COUNT_POLL_INTERVAL 5000 // 5 seconds
#define COULOMB_REMOVAL_INTERVAL 2000 // 2 seconds
#define FUEL_GAUGE_ADDRESS 0x55
#define FUEL_GAUGE_POWER_OK 0x01
#define SYSTEM_TICK_MS 1
// HAL Functions, assume these are defined elsewhere
@ryansturmer
ryansturmer / review_1_sensor.py
Last active October 25, 2024 13:56
Python Review - Sensor Code?
import threading
import struct
import serial
import time
class OmegaSensor(object):
def __init__(self, comname):
self.comname = comname
self._stop = False
self.worker = None