Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#
# This script loops doing the following:
# - wait for DFU device
# - flash DFU device
# - wait for DFU to exit
# - wait for serial port to appear
# - run a terminal
SERIAL=/dev/ttyACM1
@thinkl33t
thinkl33t / mqtt-lights-plugin.py
Created October 8, 2017 20:19
Plugin for turning off a light via MQTT when the printer starts / finishes printing - depends on the MQTT plugin
import octoprint.plugin
class MqttLightsPlugin(octoprint.plugin.StartupPlugin, octoprint.plugin.EventHandlerPlugin):
def __init__(self):
self.mqtt_publish = lambda *args, **kwargs: None
def on_after_startup(self):
helpers = self._plugin_manager.get_helpers("mqtt", "mqtt_publish")
if helpers:
@thinkl33t
thinkl33t / upop.py
Last active December 19, 2016 22:40
upop bulb controller - requires gattlib - wont work on python 3 because strings are too different :(
#!./venv2/bin/python
from gattlib import GATTRequester
class bulb:
_red = 255
_green = 255
_blue = 255
def __init__(self, address):
@thinkl33t
thinkl33t / docs.md
Created October 1, 2016 23:10
RGBW LED Bulb "U-POP U7"

More cheap LED bulbs from AliExpress

Endpoint 0x2d

4 hex bytes: bbggrrww

White will largely overpower the RGB - 0000ff44 = red tinted white

@thinkl33t
thinkl33t / gist:73e90fd5463622be1ca3f8abd6940659
Last active March 7, 2024 14:17
RGBW Bluetooth LED controller protocol

Controller for an RGBW LED strip purchased from AliExpress

It only appears to fire up the RGB strip or the white strip, never both at once.

Endpoint = 0xb = 0000ffe9-0000-1000-8000-00805f9b34fb

cc2333 - fade on, to whichever output / colour was used last.  Will re-fade if reissued.
cc2433 - fade off

56xxxxxxyyf0aa - change to RGB output - xxxxxx = colour code in hex. yy = anything hexy

@thinkl33t
thinkl33t / update.py
Created August 8, 2016 15:16
update.py with wipe
#!/usr/bin/env python
# This file is part of the OpenMV project.
# Copyright (c) 2013/2014 Ibrahim Abdelkader <i.abdalkader@gmail.com>
# This work is licensed under the MIT license, see the file LICENSE for
# details.
#
# Adapted by the EMF Badge team as a simple one-script updater
"""This module implements enough functionality to program the STM32F4xx over
DFU, without requiringdfu-util.
@thinkl33t
thinkl33t / laser_height_measure.scad
Last active September 24, 2015 15:09
Device to measure the height of the hacman laser bed.
// width of the material you are cutting the measurer from
stock_width = 3;
// total kerf of an inside and outside cut. basically the width of your laser beam
kerf = 0.1;
// depth of the material the measurer is for.
material_depth = 5;
module top()
@thinkl33t
thinkl33t / init.lua
Created April 15, 2015 23:16
esp8266 MQTT button
wifi.setmode(wifi.STATION)
wifi.sta.config("SSID","PASSWORD")
wifi.sta.connect()
tmr.alarm(1, 100, 1, function()
if wifi.sta.getip() ~= nil then
tmr.stop(1)
m = mqtt.Client( "ESP8266-" .. node.chipid(), 120)
m:connect( "192.168.1.13" , 1883, 0, function(conn)
m:publish("button/1/pressed", "", 0, 0, function(conn)
node.dsleep(0)
@thinkl33t
thinkl33t / gist:c93e3bb8252abc76da97
Created January 19, 2015 17:05
Ball Machine end
difference()
{
square([400, 120], center=true);
translate ([0,63/2,0])
{
circle(r=30/2);
for(x=[-150, -100, 100, 150])
translate([x,0]) circle(r=8/2);
}
for(x=[-192, 192])
@thinkl33t
thinkl33t / gist:5055844
Created February 28, 2013 10:43
Raspberry pi xsession
[ ! -x "`which xset 2>/dev/null`" ] || xset s off &
[ ! -x "`which xset 2>/dev/null`" ] || xset -dpms &
[ ! -x "`which xset 2>/dev/null`" ] || xset s noblank &
[ ! -x "`which unclutter 2>/dev/null`" ] || unclutter -idle 10 -noevents &
sleep 5
/usr/bin/chromium-browser --incognito --kiosk http://your.url