Skip to content

Instantly share code, notes, and snippets.

View mkfink's full-sized avatar

Michael Fink mkfink

View GitHub Profile
// Dragon staff LED controller using FastLED
// 2019 Mike Fink
// MIT License
#include <stdlib.h>
#include "FastLED.h"
#include <pixeltypes.h>
#include <stdlib.h>
FASTLED_USING_NAMESPACE
@mkfink
mkfink / patronicity-scraper.py
Last active September 17, 2019 18:48
scrape patronicity campaign for new donations and post them to slack and mqtt
# Scrapes a Patronicity fundraiser page for the list of donations
# Posts a notification in slack for new donations
# and publishes them to an mqtt-enabled display (https://www.i3detroit.org/wiki/16_segment_mqtt_display)
# requires therometer.py from https://gist.github.com/mkfink/9940ed027861b8252f6e485ee4fd8eb5
from bs4 import BeautifulSoup
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from time import sleep
import re
from slack import WebClient
@mkfink
mkfink / thermometer.py
Last active September 29, 2019 01:01
create thermometer fundraiser graphic
import svgwrite
def make_therm(fn, total, goal):
xcen = 300
ory = 75
ylen = 600
xwid = 100
rad = 100
stroke = 10
overlap = 25
@mkfink
mkfink / label_scrape.py
Last active January 22, 2020 16:55
scrape and generate images of equipment labels from wiki page
""" Scrape the wiki page of equipment labels to generate images of
each label at the resolution required by the label printer
"""
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from bs4 import BeautifulSoup
from time import sleep
from io import BytesIO
from PIL import Image
//generate undefines:
//grep "#define" ../Tasmota/tasmota/my_user_config.h | grep -v _MY_USER_CONFIG_H_ | sed 's/[\/ ]*#define \([A-Za-z_0-9]*\).*/#undef \1/' | sort | uniq | tee -a blank_defines.h
//Config for living_room_dimmer_lightswitch generated on 2020-07-25 22:32:05.096272
#ifndef _USER_CONFIG_OVERRIDE_H_
#define _USER_CONFIG_OVERRIDE_H_
/*********************************************************************************************\
* SECTION 0
* - Undefine everything first
\*********************************************************************************************/
@mkfink
mkfink / power_tracker.py
Last active August 19, 2020 04:02
Track power on/off status of sonoff attached to 3d printer for Octopi PSU Control plugin
# /home/pi/power_tracker.py
#!/usr/bin/env python3
import paho.mqtt.client as mqtt
def on_message(c, userdata, msg):
global state
payload = msg.payload.decode('utf-8')
if payload == 'ON' or payload == 'OFF':
state = payload
@mkfink
mkfink / Code.gs
Last active December 31, 2020 18:16
Laser cutter training quiz auto-email when user passes
/********************************************************************************
* Script that runs on google forms quiz result spreadsheet every time the form is
* submitted or resubmitted. If the submitter scored full points on the quiz, send
* them an email congratulating them.
* Based on: https://developers.google.com/gsuite/solutions/content-signup
* To add this to a form, in the response sheet, open Tools > Script Editor and
* paste this in there.
*********************************************************************************/
var EMAIL_TEMPLATE_DOC_URL = 'https://docs.google.com/document/d/1WXehtMLC--4R4zvhBm-qtVq7tqHlUYsgQ7YP5BrcuvU/edit?usp=sharing'
@mkfink
mkfink / test_thermostat.yaml
Last active February 1, 2022 04:14
test thermostat using esphome and esp32
packages:
board: !include common/packages/board_esp32_wroom.yaml
base_components: !include common/packages/esp_home_components.yaml
substitutions:
# device
device_name: "test_thermostat"
pretty_name: "test thermostat"
ui_name: "${pretty_name}"
# defaults