Skip to content

Instantly share code, notes, and snippets.

View spuder's full-sized avatar

Spencer Owen spuder

View GitHub Profile
@spuder
spuder / .gitignore
Last active April 9, 2024 15:22 — forked from markusand/Brewfile
macOS auto setup
Brewfile.lock.json
@spuder
spuder / Print Calendar
Created December 21, 2023 17:34
Apple Script to print out 1 month calendar, removing all digital calendars (e.g birthdays/holidays)
tell application "Calendar" to quit
delay 2
tell application "Calendar"
activate
end tell
tell application "System Events"
delay 2 -- Wait for Calendar to activate
key down {command}
keystroke "p" -- Command + P to print
key up {command}
@spuder
spuder / README.md
Last active April 8, 2023 20:10
Arudino PWM control AnkerMake M5
@spuder
spuder / README.md
Last active March 19, 2023 23:40
AnkerMake M5 Gcodes
@spuder
spuder / README.md
Last active August 28, 2022 15:39
digispark USB fun

Digispark doesn't allow using the normal Serial.println() that an arduino uses becuase it doesn't show up as a com port.

Instead you need to use hidapitester or https://github.com/Bluebie/digiusb.rb ruby app to read from USB data.

Digispark has VID/PID of 16C0/05DF

bluebie/digiusb

Start the digterm ruby app and enter 1 in the terminal. When 1 is pressed, the blue LED (pin 1) should turn on for 1/10 of a second

@spuder
spuder / Tesmart RS232.md
Last active May 11, 2023 08:09
Tesmart RS232

Tesmart KVM have a RS232 connection that can be used to switch inputs remotely.

Example compatible hardware

  • HKS0802A1U

Hardware

Option A:

  • USB to RS232 Adapter (Any should work, but I use this one )

Produces 360 images

This uses --animate which doesn't work with more than 3 frames when running in a docker container spuder/openscad-dockerhub#2

openscad /dev/null -D '$vpt = [0,0,0];' -D '$vpd = 20; $vpr = [0,$t * 360,0];' -o 'foo.png' -D 'cube([2,3,4]);' --imgsize=250,250 --animate 360 --colorscheme "Tomorrow Night"

The following all work, but not very well

@spuder
spuder / CAD .zshrc
Last active March 28, 2022 18:50
Bash create git repo for CAd files
# A bash function that will create a new git repo and configure the user.email
# Usage: Add this to your ~/.bashrc or ~/.bash_profile or ~/.zshrc files
function f360 {
_basepath="${HOME}/Code/github/spuder"
if [[ -z "$1" ]]; then echo "Usage: f360 foobar"; return 1; fi
if [[ ! -d "${_basepath}" ]]; then echo "${_basepath} doesn't exist"; return 1; fi
if [[ -d "${_basepath}/$1" ]]; then echo "Directory ${_basepath}/${1} already exists"; return 1; fi
echo "Creating ${_basepath}/${1}"
mkdir $_basepath/$1
cd $_basepath/$1
@spuder
spuder / sync_time.sh
Created August 24, 2021 01:41
Helium Miner status
export ANIMAL=angry-purple-tiger #replace with your miner
hotspot=$(curl -s https://api.helium.io/v1/hotspots/name/${ANIMAL})
# TODO: error if result != 1
miner_height=$(echo $hotspot | jq -r '.data[].status.height')
chain_height=$(echo $hotspot | jq -r '.data[].block')
percentage=$(bc <<<"scale=6; $miner_height / $chain_height")
echo "=== ${ANIMAL} ==="
echo miner_height = ${miner_height}
echo chain_height = ${chain_height}
echo lag = $((${chain_height}-${miner_height}))
@spuder
spuder / attiny85.ino
Last active April 19, 2021 01:34
Use an ATTiny 85 to 'push' momentary button
#include <avr/sleep.h>
#define adc_disable() (ADCSRA &= ~(1<<ADEN)) // disable ADC (before power-off)
int buttonPin = 0; // phyisical pin 5
int ledPin = 4; // physical pin 3
void setup() {
// https://www.notion.so/spencerowen/AtTiny-85-automated-chicken-coop-heater-596304ab6b3145769b92ddffdeb16b6f
// https://arduino.stackexchange.com/a/66655/27311