Skip to content

Instantly share code, notes, and snippets.

@bakman2
bakman2 / AI on the prize.md
Last active June 13, 2026 07:23
AI on the prize

AI (eye) on the prize

Most people misunderstand AI. AI is probalistic, not deterministic, meaning there is no fixed outcome, only a score and the highest score wins (mostly). AI's only goal is to find the highest score.

AI sets its eye on the prize, so (ab)use it like that.

If you want to find bugs in code whether or not there is a bug, keep it simple, your prompt:

@bakman2
bakman2 / ha_adaptive_light_lux.md
Last active November 15, 2024 06:36
Home assistant adaptive light brightness based on lux sensor

Home assistant adaptive light brightness based on lux sensor

Use template sensor

- sensor:
    - name: "Adaptive brightness"
      unique_id: adaptive_brightness_id_1
      state: >-
        {% set input_value = (states('sensor.lux_sensor_illuminance_lux')|int) %}
 {% set min_input_value = 400 %}

PWM fan control in Linux with a Gigabyte Aorus motherboard

  • install lm-sensors with your package manager

sensors

If it won't show any fan/speed, continue

sensor-detect

Count distinct aggregate multiple repeating elements

{"payload":[
  {
    "count": "13",
    "name": "joep",
    "total": 1
  },
  {
@bakman2
bakman2 / octoprint.md
Last active September 19, 2024 21:01
Octoprint IP Camera

How to use Octoprint with an IP camera that has an RTSP stream available

Optional: For Wyze cam only

Install Dafang Hacks on the Wyze Cam.

Once running and all is functional, continue. Set video bitrate to 1500, VBR, 30fps.

Installation

@bakman2
bakman2 / README.md
Last active April 29, 2020 06:41
uibuilder - scaffolding

node-RED uibuilder - barebone examples

Create custom dashboard or web interfaces.

ref.: node-red-contrib-uibuilder

Examples include receive and send from/to node-RED.

  • Vanilla javascript version
// Set ip address
ipaddress1 <ip>
ipaddress2 <gateway>
ipaddress3 <subnet>
ipaddress4 <dns>
// RF bridge Portisch with unknown but supported devices
rfraw 166
@bakman2
bakman2 / characteristics.json
Created July 28, 2019 10:46
Homekit characteristics object for reuse in Node-red
{
"homekit_services": [
{
"Name": "Name",
"service": "AirPurifier",
"characteristics": {
"Active": "0, 1 (active, inactive)",
"TargetAirPurifierState": "0,1 (manual, auto)",
"CurrentAirPurifierState": "0,1,2 (inactive, idle, purify air)",
"LockPhysicalControls": "0,1 (lock disabled, lock enabled)",
@bakman2
bakman2 / Dockerfile
Last active March 19, 2019 10:38
Node-RED docker with avahi
FROM nodered/node-red-docker:0.20.2
USER root
RUN apt-get update
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get -y install git python make g++ libavahi-compat-libdnssd-dev libnss-mdns dbus
RUN npm install node-red-node-discovery
COPY start.sh /
<?php
include 'functions.php';
include platformSlashes("lib/ccxt.php");
$allcoins = file_get_contents(platformSlashes('lib/data/coinlist.json'));
$coinList = json_decode($allcoins, true);
echo "debug...";
echo sizeof($config['api']). " keys found.<br/><br/>";
if(isset($config['api']) && sizeof($config['api'])>0){
foreach ($config['api'] as $key => $value) {