Skip to content

Instantly share code, notes, and snippets.

View wodor's full-sized avatar

Artur 'Wodor' Wielogorski wodor

View GitHub Profile
@wodor
wodor / install-gather.ps1
Created July 10, 2026 13:12
Install Python/Git/GitHub CLI/uv and gather-cli on Windows
# Run in an elevated PowerShell (Run as Administrator).
# If blocked by execution policy: powershell -ExecutionPolicy Bypass -File install-gather.ps1
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"
$InstallRoot = "$env:TEMP\gather-install"
New-Item -ItemType Directory -Force -Path $InstallRoot | Out-Null
function Refresh-Path {
@wodor
wodor / README.md
Created May 8, 2026 23:55
ConsecutiveTimeSwitch: state-aware scene cycling for Home Assistant + Node-RED

ConsecutiveTimeSwitch: state-aware scene cycling for Home Assistant + Node-RED

ConsecutiveTimeSwitch is a reusable Node-RED subflow for Home Assistant room switches.

It turns a normal wall/door switch into a state-aware room controller:

  • If the room/group is already on, the first flick turns the whole room off.
  • If the room/group is off, repeated flicks within a short window cycle scenes or brightness modes.
  • The same physical switch works naturally both when entering a room and when leaving it.
@wodor
wodor / nvidia-fan.sh
Created February 16, 2025 16:01
Control fan from nvidia-smi
#! /bin/bash
TEMP=$(nvidia-smi -q -d temperature | grep "GPU Current" | tail -n 1 | cut -d ":" -f 2 | cut -d " " -f 2)
DEVICE=/sys/devices/platform/nct6775.2608/hwmon/hwmon2/pwm1
echo 1 > /sys/devices/platform/nct6775.2608/hwmon/hwmon2/pwm1_enable
while true; do
TEMP=$(nvidia-smi -q -d temperature | grep "GPU Current" | tail -n 1 | cut -d ":" -f 2 | cut -d " " -f 2)
@wodor
wodor / Genny Installer
Last active January 23, 2023 08:08
Genny Installer
#!/usr/bin/env bash
expandPath() {
case $1 in
~[+-]*)
local content content_q
printf -v content_q '%q' "${1:2}"
eval "content=${1:0:2}${content_q}"
printf '%s\n' "$content"
;;
@wodor
wodor / pointers_and_interfaces.go
Last active October 27, 2021 09:41
Demonstrates how pointers work for methods with interfaces as parameters
package main
import "fmt"
func main() {
i := TheImplementation{Value: 0}
// simple, changes the value as expected
toPointer(&i)
fmt.Printf(" V: %d \n", i.Value)
@wodor
wodor / SketchSystems.spec
Created September 6, 2018 10:44
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
@wodor
wodor / SketchSystems.spec
Created September 6, 2018 10:43
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
<?php
use DOMDocument;
use DOMNode;
use eZ\Publish\API\Repository\ContentService;
use eZ\Publish\API\Repository\ContentTypeService;
use eZ\Publish\API\Repository\Repository;
use eZ\Publish\API\Repository\Values\Content\Field as ContentField;
use eZ\Publish\SPI\Persistence\Content as SPIContent;
use eZ\Publish\API\Repository\Values\Content\Content as APIContent;
<?php
use eZ\Publish\API\Repository\Values\Content\Search\Facet;
class IntervalFacet extends Facet
{
/**
* @var array
*/
public $entries;
%% initial_state return {ok, State} or {error, State}
%% before
play(Context) ->
play(Context, initial_state(Context)).
%% after
play(Context) ->
{ok, State} = initial_state(Context),