Skip to content

Instantly share code, notes, and snippets.

View MrEbbinghaus's full-sized avatar

Björn Ebbinghaus MrEbbinghaus

View GitHub Profile
@MrEbbinghaus
MrEbbinghaus / ha-auto-update.yaml
Created July 16, 2024 13:55
Home Assistant auto-update on patch
alias: HA core auto-update
description: Update HA core if there is a patch update
mode: single
trigger:
- platform: time
at: "03:00:00"
condition:
- condition: state
entity_id: update.home_assistant_core_update
state: "on"
@MrEbbinghaus
MrEbbinghaus / apds9960_esphome.yaml
Created March 25, 2024 21:30
APDS 9960 Lux calculation - ESPHome
substitutions:
IRtoIL_red: 683.0 * 0.6
IRtoIL_green: 683.0 * 0.8
IRtoIL_blue: 683.0 * 0.075
sensor:
- id: clearirradiance
name: "Clear Irradiance"
platform: apds9960
type: CLEAR
@MrEbbinghaus
MrEbbinghaus / 1.graph.clj
Last active November 16, 2023 23:17
Generate a graph of all symbols in your project from clj-kondos analyis output
(ns graph
(:require
[clj-kondo.core :as kondo]
[clojure.string :as str]
[dorothy.core :as dot]))
(def kondo-output
(kondo/run! {:lint ["/Users/bjebb/Development/decide3/src/main/decide"]
:config {:output {:analysis true}
@MrEbbinghaus
MrEbbinghaus / paths.clj
Last active August 11, 2022 10:32
Takes a (nested) map and returns all paths in that map
(fn paths [m]
(reduce-kv
(fn [acc k v]
(into acc
(map vec)
(if (and (associative? v) (not (empty? v)))
(map
#(cons k %)
(paths v))
[[k]])))
@MrEbbinghaus
MrEbbinghaus / stacktrace_segfault.txt
Created March 16, 2022 00:37
Segfault from babashka
0x00007fc031b04080 STATUS_IN_JAVA (PREVENT_VM_FROM_REACHING_SAFEPOINT) "
clojure-agent-send-off-pool-1" - 0x00000001164014a0, stack(
0x0000700008e45000,0x0000
700008ec5000)
0x00007fc031a04080
STATUS_IN_SAFEPOINT (ALLOW_SAFEPOINT) "clojure-agent-send-off-pool-0" - 0x0000
000116401810, stack(0x0000700008dc2000,
0x0000700008e42000)
0x0
(ns check-sci-compat
(:require
[clojure.string :as str]
[sci.core :as sci]
[clojure.pprint :as pprint]))
(def clojure-built-in-nss
(->> (all-ns)
(map str)
(filter #(str/starts-with? % "clojure"))
@MrEbbinghaus
MrEbbinghaus / clojure-regex.js
Created November 10, 2021 09:47
Javascript Regex for Clojure numbers
const NUMBER_RE = /[-+]?(((0[xX][0-9a-fA-F]+|0[0-7]+|[1-9][0-9]?[rR][0-9a-zA-Z]+)N?)|[0-9]+(\/[0-9]+|N|((\.[0-9]*)?([eE][+-]?[0-9]+)?M?)))/
@MrEbbinghaus
MrEbbinghaus / access-plugin.clj
Last active July 7, 2021 08:19
Access plugin for pathom
(defmulti check-access! (fn [_env [k v]] k))
(defmethod check-access! :decide.models.proposal/id
[env input]
; Add code to check access and add input to access-cache
false)
(defmethod check-access! :default [_ _] true)
(defn has-access? [env input]
(or
(contains? @(:access-cache env) input)
@MrEbbinghaus
MrEbbinghaus / signal-typing.html
Last active June 30, 2021 21:54
High CPU loads (30-60%) for three simple animations
<html>
<head>
<style>
.module-typing-animation {
display: inline-flex;
flex-direction: row;
align-items: center;
height: 8px;
width: 38px;
(ns decide.server-components.pathom
(:require
[com.wsscode.pathom.connect :as pc]
[com.wsscode.pathom.core :as p]))
(pc/defresolver my-example [_ {r :r}]
{::pc/input #{:r}
::pc/output [:r
{:x [:r]}]}
(if (< r 5)