Skip to content

Instantly share code, notes, and snippets.

View eparadis's full-sized avatar
💭
getting things done

Ed Paradis eparadis

💭
getting things done
View GitHub Profile
@eparadis
eparadis / lcd.py
Created November 11, 2022 15:08
micropython to write to a Hitachi-compatible character LCD via an attached MCP23008 IO Expander (Adafruit I2C/SPI LCD Backpack)
import mcp
import time
m = mcp.MCP23008(0x21, 0, 2)
m.output(7, True) # turn on backlight
def pulse_enable():
enable = 2
m.output(enable, False)
time.sleep_us(1)
m.output(enable, True)
@eparadis
eparadis / display_climate.py
Created November 11, 2022 15:04
micropython to update the LCD w/ climate data from the climate monitor
from lcd import initialize, puts, clear, set_pos
initialize()
puts('Ready...')
def get_climate_json():
import socket
url = 'http://192.168.0.111/data.json'
_, _, host, path = url.split('/', 3)
addr = socket.getaddrinfo(host, 80)[0][-1]
@eparadis
eparadis / mandel.fth
Last active February 5, 2022 03:14
classic terminal mandelbrot in FORTH
\ from proposal http://www.forth200x.org/fvalue.html
variable %var
: to 1 %var ! ;
: fvalue create f, does> %var @ if f! else f@ then 0 %var ! ;
0e0 fvalue i3
0e0 fvalue r3
59 value x1
21 value y1
@eparadis
eparadis / set_mute_led.py
Last active January 25, 2022 02:05
quick hack to set the LED on my prototype desktop mute button
import subprocess
def send(cmd):
subprocess.run(['bash', '-c', "echo %s > /dev/cu.usbmodem142303" % cmd ])
process = subprocess.run(['osascript', 'getZoomStatus.applescript'], stdout=subprocess.PIPE)
status = process.stdout.decode().split(',')
print(status)
state = {y[0]: y[1] for y in [x.split(':') for x in status]}
@eparadis
eparadis / meeting_countdown.sh
Created October 18, 2021 19:23
a script that writes to a text file that you can use in OBS for an on-screen meeting timer
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Usage: ./meeting_countdown.sh NUM_MINS"
exit 1
fi
MINS=$1
OUTFILE=~/src/obs/timer_out.txt
MESSAGE="time remaining in this meeting: "
@eparadis
eparadis / getZoomStatus.applescript
Created January 19, 2022 00:24
Applescript to determine the state of a Zoom meeting `smitmartijn/stream-deck-zoom-plugin`
# https://github.com/smitmartijn/streamdeck-zoom-plugin/blob/33892febdc188b2124b2a32c55b84ba3d2b5c949/Sources/MacOS.cpp#L66
# run with `osascript`
set zoomStatus to "closed"
set muteStatus to "disabled"
set videoStatus to "disabled"
set shareStatus to "disabled"
set recordStatus to "disabled"
tell application "System Events"
if exists (window 1 of process "zoom.us") then
@eparadis
eparadis / headphone_clip.scad
Created January 14, 2022 06:11
a place to rest my headphones that clips onto my cheap microphone boom arm
// headphone mount that clips on my mic arm
//difference() {
//square(20, center=true);
//square(10, center=true);
//}
@eparadis
eparadis / desktop_buttons.scad
Created January 13, 2022 22:03
desktop enclosure for five LAZ16-11 push buttons
module front_panel() {
translate([0,0,0])
cube([25*5, 30, 3]);
}
module button_hole() {
cylinder(80, d=12, center=true);
rear_clearance_depth = 10;
@eparadis
eparadis / mandel.bas
Last active January 12, 2022 04:46
ascii art mandelbrot drawing program in BASIC
10 x1=59
11 y1=21
20 i1=-1.0
21 i2=1.0
22 r1=-2.0
23 r2=1.0
30 s1=(r2-r1)/x1
31 s2=(i2-i1)/y1
40 for y=0 to y1
50 i3=i1+s2*y
@eparadis
eparadis / boot.py
Created January 6, 2022 22:05
ESP8266 MicroPython to work with a common-anode TM1638
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
import gc
import webrepl
webrepl.start()
gc.collect()