Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Osterloh rosterloh

View GitHub Profile
View code.py
from machine import I2C, Pin
import ssd1306
import mpu6050
from simulation import Simulation
i2c = I2C(scl=Pin(5), sda=Pin(4))
display = ssd1306.SSD1306_I2C(128, 64, i2c)
accel = mpu6050.accel(i2c)
s = Simulation(accel, display)
@rosterloh
rosterloh / .gdbinit
Created Oct 22, 2018
GDB init commands for Black Magic Probe
View .gdbinit
target extended-remote /dev/ttyACM0
monitor version
monitor swdp_scan
attach 1
set mem inaccessible-by-default off
@rosterloh
rosterloh / splashscreen.service
Created Oct 15, 2018
For testing run with -vt 1 on an ssh terminal
View splashscreen.service
[Unit]
DefaultDependencies=no
After=local-fs.target
Conflicts=getty@tty1.service
[Service]
StandardInput=tty
StandardOutput=tty
ExecStart=/usr/bin/fbi -d /dev/fb0 --once --noverbose --autozoom /opt/splash.png
View tkinter_dashboard.py
import datetime as dt
import tkinter as tk
import tkinter.font as tkFont
import matplotlib.figure as figure
import matplotlib.animation as animation
import matplotlib.dates as mdates
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import tmp102
import apds9301
@rosterloh
rosterloh / analyse.py
Last active Jun 6, 2018
CV-ND Project 2
View analyse.py
import sys
sys.path.append('/opt/cocoapi/PythonAPI')
from pycocotools.coco import COCO
import nltk
nltk.download('punkt')
from data_loader import get_loader
from torchvision import transforms
import torch
from collections import Counter
import numpy as np
View FileLoggingTree.java
public class FileLoggingTree extends Timber.DebugTree {
private static final String LOG_TAG = FileLoggingTree.class.getSimpleName();
@Override
protected void log(int priority, String tag, String message, Throwable t) {
try {
String path = "Log";
String fileNameTimeStamp = new SimpleDateFormat("dd-MM-yyyy",
Locale.getDefault()).format(new Date());
@rosterloh
rosterloh / heartrate.py
Created May 3, 2018
MicroPython Optical Heart Rate
View heartrate.py
from machine import Pin, Signal, I2C, ADC, Timer
import ssd1306
import time
adc = ADC(0)
i2c = I2C(-1, Pin(5), Pin(4))
display = ssd1306.SSD1306_I2C(128, 32, i2c)
MAX_HISTORY = 250
@rosterloh
rosterloh / .gitconfig
Last active Apr 13, 2018
My git aliases
View .gitconfig
[color]
ui = true
[alias]
gl = log --oneline -n 10
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
co = checkout
upstream-merge = !"git fetch origin -v && git fetch upstream -v && git merge upstream/master && git push"
[core]
pager = diff-so-fancy | less --tabs=4 -RFX
[color "diff-highlight"]
View openmv_barcode.py
# import necessary packages
import sensor
import time
import image
# import the lcd optionally
# to use the LCD, uncomment Lines 9, 24, 33, and 100
# and comment Lines 19 and 20
#import lcd
@rosterloh
rosterloh / config.txt
Last active Mar 8, 2018
Raspberry Pi Config
View config.txt
kernel=u-boot-dtok.bin
framebuffer_depth=16
# Prevent the firmware from loading HAT overlays now that we handle pin muxing.
# ourselves. See:
# https://www.raspberrypi.org/documentation/configuration/device-tree.md#part3.4
dtoverlay=
dtparam=i2c_arm=on,i2c_arm_baudrate=400000
dtparam=spi=on