Skip to content

Instantly share code, notes, and snippets.

View MOAMIndustries's full-sized avatar

Andrew Van Dam MOAMIndustries

View GitHub Profile
@MOAMIndustries
MOAMIndustries / Streaming_IMU_Logger.py
Last active November 15, 2021 04:22
Writing accelerometer values to JSON file
from Adafruit_BNO055 import BNO055
# Create and configure the BNO sensor connection.
# Configure based on your IO configuration
# Raspberry Pi configuration with serial UART and RST connected to GPIO 18:
bno = BNO055.BNO055(serial_port='/dev/serial0', rst=18)
web_path ="/var/www/html/"
while True:
#Get readings from accelerometers
heading, roll, pitch = bno.read_euler()
<html>
<head>
<script>
window.onload = function() {
console.log("LOADED");
//Configuration variables
var updateInterval = 20 //in ms
var numberElements = 200;
@MOAMIndustries
MOAMIndustries / test_signup.py
Created February 3, 2022 06:42
Testing integration of cognito postConfirmationFunction
import pytest
import boto3
from faker import Faker
import random
from dotenv import load_dotenv, find_dotenv
import os
import pytest
# 1. Account created
# 2. User is deactivated
@MOAMIndustries
MOAMIndustries / sam_generate_env.py
Created February 3, 2022 06:54
Generates a .env file with all of the logical resources ids mapped to the Physical resource ID to help facilitate tests
import boto3
import toml
#read samconfig.toml
#find the stack name
#describe stack
# output resourceIDs as env file
env_path = './.env'
@MOAMIndustries
MOAMIndustries / announce_ip.sh
Created February 17, 2022 10:31
Publish IP Address of raspberry pi to webhook
#!/bin/bash
# Announces the IP addresses of connected Interfaces to slack
# loops until curl is able to successfully POST to the webook
WEBHOOK="https://hooks.slack.com/services/FOO/BAR"
IPs=$(ip -br address | awk -F "[ ]+" '/UP/{print " ", $1, $3}')
SERIAL=$(cat /proc/cpuinfo | awk -F "[: ]+" '/Serial/{print " ", $2}')
HOSTNAME=$(hostname)
until curl -s -X POST -H 'Content-type: application/json' --data "{\"text\":\"\n*Raspberry Pi now online*\n_Serial:_ $SERIAL\n_Host:_ $HOSTNAME\n_Interface addresses:_\n$IPs\"}" $WEBHOOK
@MOAMIndustries
MOAMIndustries / Image
Created March 21, 2022 13:01
ROS2 Environment for Raspberry Pi
A Raspberry Pi4 with at least 4GB of Ram is recommended
Each version of ROS is tied to a specific release of Ubuntu.
We are going to use ROS2 Galactic which is tied to Ubuntu 20.4 Focal.
With full desktop support.
The Raspberry Pi foundations Pi Imager tool makes this easy. If you have not used it before,
you can download it from https://www.raspberrypi.com/software/
--- IMPORTANT: select the 64 bit version of Ubuntu ---