Skip to content

Instantly share code, notes, and snippets.

View v6ak's full-sized avatar

Vít Šesták v6ak

View GitHub Profile
# Definuju skupinu. Tu nepoužívám přímo, ale přes FirefoxOptions. Mohu použít více různých FirefoxOptions, pak se mi to automaticky spojí do jedné skupiny, jako bych vše nacpal do jednoho FirefoxOptions.
class FirefoxOptionsGroup(MandatoryGroup, NamedTuple('FirefoxOptionsGroup', [('rw', bool)])):
def create_sequence(self, target: Target, name: NameCollection, specs: List[Spec], index: int) -> List[Tuple[NameCollection, Group, Task]]:
if not isinstance(target, QubeTarget):
raise Exception("Bad target: "+str(target))
if index == 0:
dicts = list(map(lambda f: f.options, specs))
options_len_sum = sum(map(len, dicts))
@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=""