Skip to content

Instantly share code, notes, and snippets.

View t413's full-sized avatar

Tim O'Brien t413

View GitHub Profile
@t413
t413 / blackboxPull.sh
Created March 8, 2022 19:47
Enables Betaflight blackbox filesystem-mode, archives files, then erases blackbox (for MacOS)
### enables betaflight blackbox filesystem-mode, archives files, then erases blackbox (after manual power cycle)
# usage blackboxPull /dev/tty.my.serial [optional folder to output, default is pwd/logs]
function blackboxPull() {
port="${1}";
folder="${2:-logs}";
[ -f "$port" ] || { echo "port \"$port\" doesn't exist!"; return 1; }
{ echo "#"; sleep 0.5; echo msc; } >> "$port"; ##enables cli then sends command for flash download
sleep 4;
echo "copying files to ${folder}";
@t413
t413 / newled.sh
Created May 4, 2018 09:26
led backpack 2.0
#!/bin/bash
[ -t 0 ] && hash tput 2>/dev/null && COLOR_SHELL=true || COLOR_SHELL=false
function clr_gr() { [ "$COLOR_SHELL" = true ] && echo "$(tput setaf 0)$(tput setab 2)"; }
function clr_bl() { [ "$COLOR_SHELL" = true ] && echo "$(tput setaf 7)$(tput setab 4)"; }
function echo_gr() { [ "$COLOR_SHELL" = true ] && echo "$(clr_gr) $@ $(endcolor)" || echo "$@"; }
function echo_bl() { [ "$COLOR_SHELL" = true ] && echo "$(clr_bl) $@ $(endcolor)" || echo "$@"; }
function endcolor() { [ "$COLOR_SHELL" = true ] && echo "$(tput sgr 0)" || echo "$@"; }
function logme() { echo_bl "$@" >&2; }
@t413
t413 / ledbackpack.sh
Created December 10, 2017 13:35
LED Backpack with raspberry pi 3
#!/bin/bash
[ -t 0 ] && hash tput 2>/dev/null && COLOR_SHELL=true || COLOR_SHELL=false
function clr_gr() { [ "$COLOR_SHELL" = true ] && echo "$(tput setaf 0)$(tput setab 2)"; }
function clr_bl() { [ "$COLOR_SHELL" = true ] && echo "$(tput setaf 7)$(tput setab 4)"; }
function clr_rd() { [ "$COLOR_SHELL" = true ] && echo "$(tput setaf 7)$(tput setab 1)"; }
function clr_or() { [ "$COLOR_SHELL" = true ] && echo "$(tput setaf 0)$(tput setab 3)"; }
function clr_ma() { [ "$COLOR_SHELL" = true ] && echo "$(tput setaf 7)$(tput setab 5)"; }
function endcolor() { [ "$COLOR_SHELL" = true ] && echo "$(tput sgr 0)" || echo "$@"; }
function echo_gr() { [ "$COLOR_SHELL" = true ] && echo "$(clr_gr) $@ $(endcolor)" || echo "$@"; }
#include <FastLED.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_LEDBackpack.h>
#include <Encoder.h>
#include <avr/sleep.h>
#include <avr/power.h>
@t413
t413 / esp-test.ino
Last active October 25, 2017 23:44
ESP8266 LIPO OLED development board Example Sketch
//compile with SparkFun Thing Dev, upload works great at 921600 Baud!
// backup demo flash first with `esptool.py read_flash 0x00000 0x400000 factory-0-0x400000.bin`
// restore with `esptool.py --baud 921600 write_flash 0x0000 factory-0-0x400000.bin`
// get esptool.py with `pip install esptool`
#include <ESP8266WiFi.h>
#include <U8g2lib.h>
#include <FastLED.h>
// the OLED used
@t413
t413 / update.sh
Created July 23, 2016 00:11
manage a OpenWRT LetsEncrypt https instalation
#!/usr/bin/env sh
## update.sh - manage a OpenWRT LetsEncrypt https instalation
# HOWTO:
# - put update.sh in its own directory (like /root/.https)
# - run ./update.sh your.domain.com (that domain needs to point to your router)
# * this get an issued cert from letsencrypt.org using the webroot verification method
# * also installs curl and ca-certificates packages
# - use crontab -e; add the line `0 0 * * * "/root/.https/update.sh" >>/root/.https/log.txt 2>&`
# * this runs the update every day, logging everything to log.txt
#
@t413
t413 / wii_recieve_car.ino
Created August 7, 2014 02:31
Arduino XBee/Wii Receiver
/* Author: Tim O'Brien
* Site: t413.com
* Lisence: Creative Commons Attribution-Noncommercial-Share Alike 3.
* this file updated: 12/23/09
*
* Let me know if you're using or adapting this,
* Leave a comment, send an email, I'd like to hear about it.
*/
#define M1 1
#define M2 0
@t413
t413 / GetHTTPsAsync.java
Created July 10, 2012 02:33
Asynchronous HTTP/HTTPS Get String
/* -- USAGE: -- */
//to start a new download
new GetHTTPsAsync("https://hi.com") {
//provide a callback:
protected void onPostExecute(String res) {
Log.v(res); //yay, new string!
}
@t413
t413 / Aperture_SFTP_Exporter.scpt
Created June 24, 2012 06:14
Aperture SFTP Exporter AppleScript
--
-- Aperture SFTP Exporter --
-- by Tim O'Brien, t413.com
--
-- -uses selected images in Aperture
-- -exports images to a subdirectory (asks each time, default is based on project name)
-- -growl notifications of sftp upload progress
-- -speed metrics (upload speed, export speed)
--