Skip to content

Instantly share code, notes, and snippets.

Avatar

Tom Robinson tlrobinson

View GitHub Profile
@tlrobinson
tlrobinson / env.sh
Created Apr 23, 2020
evaluate and export .env files
View env.sh
# evaluates .env and exports all variables inside of it
source .env && export $(grep -oE "^[^=]+" .env)
@tlrobinson
tlrobinson / ttgo_oled_example.ino
Last active Jan 5, 2020
Using the OLED display on TTGO LoRa32 development boards and "ESP8266 and ESP32 OLED driver for SSD1306 displays" library
View ttgo_oled_example.ino
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
#include "SSD1306Wire.h" // legacy: #include "SSD1306.h"
// TTGO LoRa32-OLED V1
//
// #define OLED_SDA 4
// #define OLED_SCL 15
// #define OLED_RST 16
// TTGO LoRa32-OLED v2.0 and V2.1
@tlrobinson
tlrobinson / immutable-wrappers.md
Last active Sep 30, 2019
Metabase immutable wrapper classes
View immutable-wrappers.md

metabase-lib/lib/metadata:

  • "Base" base class
  • copies properties
  • also includes "_plainObject"
  • external logic sets up references, lame: "metabase/selectors/metadata"

metabase-lib/lib/Dimension.js:

  • "Dimension" base class, encode each clause as a different subclass
  • also includes optional "_parent" (actually a child in the tree, i.e. ["field-id", 1] is a _parent in ["datetime-field", ["field-id", 1], "month"]) and "_args" which are rest of clause args (month the datetime-field or 1 in the field-id)
  • also includes "_metadata" and "_query" properties
@tlrobinson
tlrobinson / geiger.ino
Last active Sep 12, 2019
MightyOhm Geiger Counter Kit + ESP8266 (WEMOS D1 mini) https://mightyohm.com/blog/products/geiger-counter/
View geiger.ino
// get config.h from Adafruit IO example sketch and fill in your details
#include "config.h"
#include <Pins_Arduino.h>
#include <SoftwareSerial.h>
#include <Regexp.h>
AdafruitIO_Feed *cpm_feed = io.feed("Geiger CPM");
AdafruitIO_Feed *cps_feed = io.feed("Geiger CPS");
AdafruitIO_Feed *usv_feed = io.feed("Geiger uSv/hr");
@tlrobinson
tlrobinson / bbs.sh
Last active Sep 26, 2020
ham radio / amateur radio setup notes for mac and raspberry pi
View bbs.sh
#!/usr/bin/env bash
# e.x.
#
# bbs.sh KE6JJJ-1 1200 145090000
# bbs.sh KE6JJJ-1 9600 433370000
#
set -eu
@tlrobinson
tlrobinson / webapp.md
Last active Mar 6, 2019
Polished Single Page Web Application Concerns
View webapp.md
  • loading and error states
  • form validation/errors + dirty/invalid states
  • empty states
  • pagination and/or virtualization/windowing of large lists
  • normalizing state to ensure consistency
  • caching requests / cache invalidation
  • immediate feedback: optimistic updates and/or loading states
  • blocking duplicate actions (loading/dirty states for SPA, POST/redirect/GET for non-SPA)
  • cancelling pending requests when making an updated request (e.x. typeahead), or when navigating away from the screen that depends on it
  • keyboard/mouse events:
@tlrobinson
tlrobinson / docker-build-context-ls.sh
Created Jan 21, 2019
Script for listing the Docker build context of the current directory
View docker-build-context-ls.sh
#!/usr/bin/env bash
set -eu
tag=tmp-docker-build-context
docker build --no-cache -t $tag -f - . <<EOD
FROM busybox
RUN mkdir /_/
View gist:ab0ab25a17793427410552923ea546aa
{
Devices {
devices {
deviceId
uuid
}
}
AirDataLatest(uuid: "awair-...") {
airDataSeq {
score
View docker-machine-push
#!/usr/bin/env bash
set -eu
MACHINE=$1
IMAGE=$2
MONITOR=$(command -v pv || echo cat)
docker save $IMAGE | bzip2 | $MONITOR | docker-machine ssh $MACHINE 'bunzip2 | docker load'
You can’t perform that action at this time.