Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
tlrobinson / env.sh
Created April 23, 2020 16:31
evaluate and export .env files
# evaluates .env and exports all variables inside of it
source .env && export $(grep -oE "^[^=]+" .env)
@tlrobinson
tlrobinson / ttgo_oled_example.ino
Last active November 22, 2021 18:30
Using the OLED display on TTGO LoRa32 development boards and "ESP8266 and ESP32 OLED driver for SSD1306 displays" library
#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 September 30, 2019 17:33
Metabase immutable wrapper classes

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 September 12, 2019 20:11
MightyOhm Geiger Counter Kit + ESP8266 (WEMOS D1 mini) https://mightyohm.com/blog/products/geiger-counter/
// 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 April 14, 2021 13:56
ham radio / amateur radio setup notes for mac and raspberry pi
#!/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 March 6, 2019 23:29
Polished Single Page Web Application Concerns
  • 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 January 21, 2019 21:12
Script for listing the Docker build context of the current directory
#!/usr/bin/env bash
set -eu
tag=tmp-docker-build-context
docker build --no-cache -t $tag -f - . <<EOD
FROM busybox
RUN mkdir /_/
{
Devices {
devices {
deviceId
uuid
}
}
AirDataLatest(uuid: "awair-...") {
airDataSeq {
score
#!/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'