Skip to content

Instantly share code, notes, and snippets.

View dbuezas's full-sized avatar
👾

David Buezas dbuezas

👾
View GitHub Profile
@dbuezas
dbuezas / README.md
Last active April 21, 2024 20:13
Pie Chart Labels with missing data

This variation of a donut chart demonstrates how to add labels with lines and also works with missing/new data. Clicking on the button changes the displayed data.

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 / README.md
Last active March 15, 2024 04:40
Pie charts labels

This variation of a donut chart demonstrates how to add labels with lines. Clicking on the button changes the displayed data. Check Pie Chart with Labels and Missing Data to see how to handle transitions with missing/new data.

@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 / 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);
});
@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/wasm@0.3.11/dist/index.min.js"></script>
<script src="https://unpkg.com/d3-graphviz@3.0.5/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/wasm@0.3.11/dist/index.min.js"></script>
<script src="https://unpkg.com/d3-graphviz@3.0.5/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>
// Just require this file
// david@shop.co
// 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.