Skip to content

Instantly share code, notes, and snippets.

View v6ak's full-sized avatar

Vít Šesták v6ak

View GitHub Profile
@v6ak
v6ak / secrets.yaml
Last active April 13, 2024 20:20
ESPHome config for IKEA Vindrikting with LáskaKit v3 board
api_encryption_key: "don't expect me to publish it"
ota_key: "are you serious?"
wifi:
id: wifi_id
networks:
- ssid: "some wireless fiction network"
password: assword
- ssid: "some other wireless network"
@v6ak
v6ak / Dockerfile
Last active April 8, 2024 18:51
Quick hack for QuietDrift in Home Assistant; Alternatively, you can use addon, which also supports BLE proxies: https://github.com/v6ak/v6-quietdrift
FROM python:3
RUN pip install PySwitchbot quart
RUN mkdir -p /opt/psbs
COPY server.py /opt/psbs
WORKDIR /opt/psbs
ENTRYPOINT hypercorn -b 0.0.0.0:8080 --log-level INFO --access-logfile - --error-logfile - server:app
@v6ak
v6ak / Makefile
Last active January 27, 2024 08:47
Failure handler hello world addon for madduck/Docspell
target/addon.zip: docspell-addon.yaml addon.sh sample.vcf
# prepare
mkdir -p target
rm -rf target/unpacked
mkdir target/unpacked
# addon.sh + sample.vcf
cp addon.sh sample.vcf target/unpacked
chmod +x target/unpacked/addon.sh
# docspell-addon.yaml
cat docspell-addon.yaml | sed 's#$$VERSION#0.$(shell date +%s)#' > target/unpacked/docspell-addon.yaml
@v6ak
v6ak / ComputerDesk.scala
Last active January 15, 2024 12:55
Hagen: computer desk notifications
import com.v6ak.HeteroMap
import com.v6ak.hagen.actions.*
import com.v6ak.hagen.automation.{AutomationBase, Change}
import com.v6ak.hagen.dashboards.*
import com.v6ak.hagen.expressions.*
import com.v6ak.hagen.extensions.highlights.{Highlightable, Highlightables, SimplePositiveCondition}
import com.v6ak.hagen.output.*
import com.v6ak.hagen.{BinarySensorDef, SensorDef}
import scala.concurrent.duration.*
@v6ak
v6ak / dmenu-sort.py
Last active November 23, 2023 20:22
dmenu-wrapper.s
#!/bin/env python3
import sys
import re
from typing import Tuple
def remove_suffix(s, suffix):
if s.endswith(suffix):
return s[0:-len(suffix)]
else:
return None
target/addon.zip: docspell-addon.yaml addon.sh
# prepare
mkdir -p target
rm -rf target/unpacked
mkdir target/unpacked
# addon.sh
cp addon.sh target/unpacked
chmod +x target/unpacked/addon.sh
# docspell-addon.yaml
cat docspell-addon.yaml | sed 's#$$VERSION#0.$(shell date +%s)#' > target/unpacked/docspell-addon.yaml
fastOptJS / scalaJSLinkerConfig ~= {
_.withModuleKind(ModuleKind.ESModule)
.withModuleSplitStyle(ModuleSplitStyle.SmallModulesFor(List("com.v6ak.zbdb")))
},
fullOptJS / scalaJSLinkerConfig ~= {
_.withModuleKind(ModuleKind.CommonJSModule)
.withModuleSplitStyle(ModuleSplitStyle.FewestModules)
},
#!/bin/bash
# safety settings
set -u
set -e
set -o pipefail
function run {
version="$1"
if [ "$version" == "" ]; then
version_spec=""
#!/bin/bash
# safety settings
set -u
set -e
set -o pipefail
function run {
version="$1"
if [ "$version" == "" ]; then
version_spec=""
@v6ak
v6ak / externs.js
Last active October 19, 2023 17:53
Hack for using Scala.js + ES modules + Google Closure Compiler
var require;
// scala.js externs
//var Object;
Object.prototype.constructor;
Object.prototype.toString;
Object.prototype.$classData;
//var Array;
Array.prototype.length;