Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Osterloh rosterloh

View GitHub Profile
@rosterloh
rosterloh / getopts.sh
Created Jun 2, 2014
An example of how to use bash getopts
View getopts.sh
#!/bin/bash
######################################################################
#This is an example of using getopts in Bash. It also contains some
#other bits of code I find useful.
#Author: Linerd
#Website: http://tuxtweaks.com/
#Copyright 2014
#License: Creative Commons Attribution-ShareAlike 4.0
#http://creativecommons.org/licenses/by-sa/4.0/legalcode
@rosterloh
rosterloh / gpio.java
Created Aug 18, 2014
Android class for GPIO control
View gpio.java
public class GPIO {
public String port;
public int pin;
//get direction of gpio
public String getInOut()
{
String command = String.format("cat /sys/class/gpio/%s/direction",this.port);
try {
View arducam_trigger.py
import cv2
import numpy as np
from datetime import datetime
import array
import fcntl
import os
import argparse
from utils import ArducamUtils
import Jetson.GPIO as GPIO
from time import sleep
@rosterloh
rosterloh / m5cam.yaml
Last active Oct 13, 2020
ESPHome for m5cam
View m5cam.yaml
esphome:
name: m5cam
platform: ESP32
board: m5stack-core-esp32
wifi:
ssid: "ssid"
password: "password"
# Enable logging
@rosterloh
rosterloh / boot.py
Created May 28, 2019
CircuitPlayground Express Current Logger
View boot.py
# boot.py
# Set Circuit Playground Express flash chip to program writeable
# If toggle switch is right,
# flash is program writeable and file access is frozen
# If toggle switch is left,
# flash chip file access ok, file writes give an error
# via Dan Conley
# https://learn.adafruit.com/cpu-temperature-logging-with-circuit-python/
# writing-to-the-filesystem
# 2018 Mike Barela for Getting Started with Circuit Playground Express
@rosterloh
rosterloh / covid-19.service
Created Mar 27, 2020
COVID-19 tracker on a PiminiTFT
View covid-19.service
[Unit]
Description=COVID-19 Tracker Service
After=multi-user.target
[Service]
User=pi
Type=simple
WorkingDirectory=/home/pi/CovidTracker
ExecStart=/usr/bin/python3 /home/pi/CovidTracker/main.py --update 3600
Restart=on-failure
@rosterloh
rosterloh / .bash_aliases
Last active Jan 22, 2020
My bash aliases
View .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 / init.lua
Created Apr 8, 2015
NodeMCU firmware for ultrasonic detector on a ESP-12
View init.lua
--
-- Simple object avoider robot using the ESP8266/Nodemcu ESP-12
-- Using a L9110s h-bridge and an hc-sr04 with a 1k resistor
-- on the ECHO pin.
--
-- The current ESP only allows for 3 active pwms at any one time.
-- We get around this by the fact we only need 2 at any time. Each
-- direction change resets them pins used as pwm.
--
-- Written by Scott Beasley 2015
View jupyter_lab.service
[Unit]
Description=Jupyter Notebook Service
[Service]
Type=simple
User=user
ExecStart=/bin/sh -c "jupyter lab --ip=0.0.0.0 --no-browser"
WorkingDirectory=/home/user
Restart=always
@rosterloh
rosterloh / OscScreenGrabLAN.py
Created Jul 15, 2019
python OscScreenGrabLAN.py png|bmp|csv oscilloscope_IP
View OscScreenGrabLAN.py
#!/usr/bin/env python3
"""Take screen captures from DS1000Z-series oscilloscopes
This program captures either the waveform or the whole screen of a Rigol
DS1000Z series oscilloscope, then saves it on the computer as a CSV, PNG
or BMP file.
The program uses the LXI protocol, so the computer must have a LAN
connection with the oscilloscope.
"""