Skip to content

Instantly share code, notes, and snippets.

@vprusa
vprusa / characteristics.js
Last active November 3, 2023 18:16
UART terminal (with performance test) sketch for google chrome's Web Bluetooth GATT communication with ESP32 BLE
//https://googlechrome.github.io/samples/web-bluetooth/get-characteristics.html?service=6e400001-b5a3-f393-e0a9-e50e24dcca9e&characteristic_read=6e400002-b5a3-f393-e0a9-e50e24dcca9e
var bluetoothDevice;
var bluetoothDeviceWriteChar;
var bluetoothDeviceNotifyChar;
var timeNow, timeWriteLast, timeNotifyLast;
function str2ab(str) {
var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
@frenck
frenck / doorbell.yaml
Last active March 31, 2024 13:29
Blog: For just $2, convert any existing wired doorbell into a smart doorbell; using ESPHome and Home Assistant: https://frenck.dev/diy-smart-doorbell-for-just-2-dollar/
---
esphome:
name: doorbell
platform: ESP8266
board: esp01_1m
# WiFi connection, correct these
# with values for your WiFi.
wifi:
ssid: !secret wifi_ssid
@det-peralta
det-peralta / hassio_jetson_nano.sh
Created May 6, 2019 14:22
Install Hassio on Nvidia Jetson Nano
sudo -i
apt-get install software-properties-common
add-apt-repository universe
apt-get update
apt-get install -y apparmor-utils apt-transport-https avahi-daemon ca-certificates curl dbus jq network-manager socat
#The jetson already has docker installed
#curl -fsSL get.docker.com | sh
curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s -- -m qemuarm-64
@aallan
aallan / throttled.sh
Last active March 17, 2024 04:42
Script to parse the output of the 'vcgencmd get_throttled' command on a Raspberry Pi
#!/bin/bash
# https://retropie.org.uk/forum/topic/2295/runcommand-warning-if-voltage-temperature-throttling
#Flag Bits
UNDERVOLTED=0x1
CAPPED=0x2
THROTTLED=0x4
HAS_UNDERVOLTED=0x10000
HAS_CAPPED=0x20000
/*
Sketch for ESP8266 testing the issue 13, namely multiple tcp server connections
https://github.com/JiriBilek/WiFiSpi/issues/13
*/
#include <ESP8266WiFi.h>
const char* ssid = "****";
const char* password = "****";
@janjongboom
janjongboom / 1_instructions.md
Created June 18, 2018 03:23
DISCO_F413ZH debugging with OpenOCD and Visual Studio Code
  1. Download OpenOCD.

  2. Place the folder in ~/openocd - so that the scripts is directly under ~/openocd/scripts.

  3. Add it to your PATH via:

    ln -s ~/openocd/bin/openocd /usr/local/bin/openocd

  4. Make sure no applications are bound to port 3333.

  5. Place launch.json and tasks.json in your .vscode folder.

Note: Set the right path in debugServerArgs.

@wictorwilen
wictorwilen / azureiot.md
Last active October 19, 2022 19:21
Azure IoT integration for Home Assistant

layout: page title: "Azure IoT" description: "Offers support for Azure IoT integration with Homeassistant." date: 2017-10-22 14:18 sidebar: true comments: false sharing: true footer: true logo: home-assistant.png

@adamkewley
adamkewley / SerialPortExtensions.cs
Created December 4, 2015 20:33
Extension methods to make System.IO.Ports.SerialPort easier to use with .NET 4.5 async workflows (Does not support timeouts)
using System.IO.Ports;
namespace AsyncExtensions {
public static class SerialPortExtensions
{
/// <summary>
/// Read a line from the SerialPort asynchronously
/// </summary>
/// <param name="serialPort">The port to read data from</param>
/// <returns>A line read from the input</returns>
@pushrbx
pushrbx / SerialPortWrapper.cs
Created September 8, 2015 13:36
C# Serial Port wrapper. Works great with arduinos.
using System;
using System.IO.Ports;
using System.Threading;
using System.Threading.Tasks;
namespace AwesomeSerialDeviceWrapper
{
public class SerialDevice : IDisposable
{
private long m_timeSinceLastEvent;
@katowulf
katowulf / 1_query_timestamp.js
Last active September 21, 2023 20:28
Get only new items from Firebase
// assumes you add a timestamp field to each record (see Firebase.ServerValue.TIMESTAMP)
// pros: fast and done server-side (less bandwidth, faster response), simple
// cons: a few bytes on each record for the timestamp
var ref = new Firebase(...);
ref.orderByChild('timestamp').startAt(Date.now()).on('child_added', function(snapshot) {
console.log('new record', snap.key());
});