Skip to content

Instantly share code, notes, and snippets.

View rosterloh's full-sized avatar

Richard Osterloh rosterloh

View GitHub Profile
@rosterloh
rosterloh / .gdbinit
Created October 22, 2018 12:44
GDB init commands for Black Magic Probe
target extended-remote /dev/ttyACM0
monitor version
monitor swdp_scan
attach 1
set mem inaccessible-by-default off
@rosterloh
rosterloh / splashscreen.service
Created October 15, 2018 14:07
For testing run with -vt 1 on an ssh terminal
[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
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 June 6, 2018 20:04
CV-ND Project 2
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
@rosterloh
rosterloh / FileLoggingTree.java
Created May 7, 2018 09:40
Timber log to file
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 08:34
MicroPython Optical Heart Rate
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 April 13, 2018 10:18
My git aliases
[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"]
# 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 March 8, 2018 12:32
Raspberry Pi Config
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
@Singleton
public class FirebaseAdapter {
private FirebaseAuth.AuthStateListener mAuthListener;
private FirebaseAuth mAuth;
@Inject
public FirebaseAdapter() {
mAuth = FirebaseAuth.getInstance();
initialiseAuth();