Skip to content

Instantly share code, notes, and snippets.

View dbuezas's full-sized avatar
👾

David Buezas dbuezas

👾
View GitHub Profile
blueprint:
name: ZHA - Smart Knob for lights
source_url: https://gist.github.com/dbuezas/832d15a762488f2754c59bc9ca9632da
description: "Control lights with a Moes Smart Knob.
Rotating left/right will change the brightness smoothly of the selected light
and making use of step_size.
Press-Rotating left/right will change the color temperature (or hue).
Long press switches between color temperature and rgb modes.
@dbuezas
dbuezas / restart_bluetooth.sh
Created December 8, 2023 17:52
Restart bluetooth dongles
# Get a list of all controllers
controllers=$(bluetoothctl list | awk '{print $2}')
# Loop through each controller and restart it
for controller in $controllers; do
echo "Turning off: $controller"
# Turn off the controller
echo -e "select $controller\npower off" | bluetoothctl
done
@dbuezas
dbuezas / SoftWire.cpp
Last active November 23, 2023 14:16
stm32 optimized SoftWire
/*
Modified SoftWire.cpp file that:
- Uses native stm32 calls to manage GPIO
- Removes all delays between gpio calls
- Clock working at ~260kHz on an STM32H723VG (SKR 3)
Make sure to set the right SCL and SDA port and pin below
*/
// If possible disable interrupts whilst switching pin direction. Sadly
// there is no generic Arduino function to read the current interrupt
@dbuezas
dbuezas / index.html
Last active September 7, 2021 14:25
test with interrupt fix
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/@hpcc-js/[email protected]/dist/index.min.js"></script>
<script src="https://unpkg.com/[email protected]/build/d3-graphviz.js"></script>
<button onclick="run()">RUN</button>
<div>
<div style="width: 25%; float: left;">
<div id="comment1"></div>
@dbuezas
dbuezas / index.html
Last active September 7, 2021 14:03
Demo of d3-graphviz transition interruptions not working
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="//d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/@hpcc-js/[email protected]/dist/index.min.js"></script>
<script src="https://unpkg.com/[email protected]/build/d3-graphviz.js"></script>
<button onclick="run()">RUN</button>
<div width="100%">
<div width="100%" style="width: 30%; float: left;">
<div id="comment1"> </div>
@dbuezas
dbuezas / scribd2pdf.js
Last active December 26, 2022 14:23
loads all jpegs and makes a pdf with them
load = async (url) => {
var head= document.getElementsByTagName('head')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= url;
return new Promise(resolve => {
script.addEventListener('load', resolve);
head.appendChild(script);
});
// Just require this file
// [email protected]
// npm install colors
var ms, oldLog, path,
slice = [].slice;
require('colors');
path = require('path');

Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

-- Execute -> Install
-- Keyboard -> Shortcuts -> Services -> playpause soundcloud -> set your Shortcut
set titleString to ""
tell application "Google Chrome"
activate
set window_list to every window # get the windows
set the_window_index to 0
repeat with the_window in window_list # for every window
set the_window_index to the_window_index + 1
#!/usr/bin/osascript
# Name of the device as visible in Safari->Develop menu
set deviceName to "iPhone Simulator"
# Number of seconds to wait for the simulator window to show up
set maxWait to 30
# ---------------------------------------
# You shouldn't modify anything below here