Skip to content

Instantly share code, notes, and snippets.

View rosterloh's full-sized avatar

Richard Osterloh rosterloh

View GitHub Profile
@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();
@rosterloh
rosterloh / .bash_aliases
Last active January 22, 2020 10:12
My bash aliases
alias update='sudo apt update && sudo apt dist-upgrade -y --auto-remove'
alias adb_camera='adb shell am start -a android.media.action.IMAGE_CAPTURE'
alias adb_launch='adb shell am start -a android.intent.action.MAIN '
alias adb_brightness='adb shell am broadcast -a com.enhancedworld.devicemanager.SET_BRIGHTNESS --ei com.enhancedworld.devicemanager.extra.LEVEL '
alias adb_flash_boot='adb remount; adb sync; adb reboot bootloader; fastboot flash boot $OUT/boot.img; fastboot reboot'
alias adb_peripherals='adb shell dumpsys com.google.android.things.pio.IPeripheralManager'
alias cat='bat --theme zenburn'
alias ping='prettyping --nolegend'
alias du="ncdu --color dark -rr -x --exclude .git --exclude node_modules"
alias grep="grep -n -I --color"
@rosterloh
rosterloh / DB410c.md
Created October 12, 2016 11:20
Notes from Coursera IoT Course 2
@rosterloh
rosterloh / daemon.c
Created April 25, 2016 07:23
A linux daemon skeleton
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
int maxfd, fd;
@rosterloh
rosterloh / script.sh
Created April 6, 2016 07:48
A better options parser for a bash script
#!/usr/bin/env sh
# Default values for blank parameters
DEBUG=0
IN_FILE=/etc/some-input-file.conf
OUT_FILE=/var/log/some-output-file.log
# Option parser, the order doesn't matter
while [ $# -gt 0 ]; do
case "$1" in
@rosterloh
rosterloh / unblockdns.md
Created February 16, 2016 08:24 — forked from esamattis/unblockdns.md
Transparent Netflix only region unblock with Asuswrt Merlin

Transparent Netflix only region unblock with Asuswrt Merlin

Ad-free time!, UnoTelly etc. services provide a nice way to unblock regions for Netflix and others using their custom DNS servers.

But I don't want to direct all my DNS traffic to them and I'm too lazy to manually configure all my devices (phones, tablets, media center boxes etc.). So here's how to transparently unblock Netflix for all your devices using the [Asuswrt Merlin][merlin] firmware. It's a custom router firmware which can be used on the Asus RT-N66U router for example.

Prerequisites

Enable JFFS partition and SSH login from http://<ROUTER-IP>/Advanced_System_Content.asp