Skip to content

Instantly share code, notes, and snippets.

@adrianjost
adrianjost / sigma-data-center-rename.py
Last active February 9, 2025 13:56
A utility to change filenames exported from Sigma Data Center (as .fit) to a format that can be copied to the Activities directory of an ROX 4.0 so it is synced back into the Sigma Ride App. The `D4790161BC34` part might be specific to your ROX 4.0, so it you maybe have to replace that one.
import os
import uuid
import datetime
import shutil
import sys
from fitparse import FitFile
def extract_activity_start_time(fit_path):
"""Extracts the activity start time from a .fit file."""
try:
@adrianjost
adrianjost / tado_window.yaml
Created March 19, 2023 09:57
HomeAssistant - Tado Open Window Heating Control Blueprint
# copy file to blueprints/automation/homeassistant/tado_window.yaml
blueprint:
name: Tado Open Window Heating Control
description: Pauses the auto control for 15min when an open window is detected in a room.
domain: automation
input:
window_entity:
name: Window Sensor
description: The window sensor that controls the climate entity.
selector:
@adrianjost
adrianjost / config.fish
Last active April 10, 2024 06:24
My MacOS Setup
# ~/.config/fish/config.fish
set -x LANG en_US.UTF-8
if status is-interactive
# Commands to run in interactive sessions can go here
end
# load Fish Shell UI Configuration
starship init fish | source
@adrianjost
adrianjost / cct_linear_light.ino
Created August 14, 2021 09:35
Linear Potentiometer to quadratic CCT Light - Arduino Controlled
// Uses a linear potentiometer to adjust the brightness of an CCT light connected to the arduino.
// the darker the light, the warmer the color temperature gets.
// The brightness get's adjusted quadratically to the potentiometer value.
// This is ideal for a night lamp with fine control in the lower spectrum but the ability to use full brightness at day.
#define PIN_WW 5
#define PIN_CW 6
#define PIN_IN A0
#define MAX_BRIGHTNESS 255
#define threshold 10
@adrianjost
adrianjost / receive.ino
Last active May 5, 2023 22:08
Brennenstuhl / toom 433 MHZ Radio-controlled socket (Funksteckdose)
/*
Sources:
https://arduino-projekte.info/funk-sender-433mhz-auslesen-mit-arduino/
https://daniel-ziegler.com/arduino/mikrocontroller/2017/06/16/Funksteckdose-arduino/
also note, that I received protocol 3 or 5 with this script,
but the internet suggested to use 4 when sending and only 4 seems to work.
How to use:
Flash this on your Arduino and hold the button you want to read until you received 4 different values.
@adrianjost
adrianjost / easylight.ino
Last active June 7, 2020 14:58
Arduino WWCW One Button Control
#define LED_WW 5
#define LED_CW 6
#define BTN 7
#define BRIGHTNESS_MAX 255
#define TIMEOUT 500
#define TIMEOUT_INFINITY 60000 // 1min
#define BRIGHNESS_STEP 1
#define BRIGHNESS_STEP_DURATION 15
#define TEMP_STEP 0.01
@adrianjost
adrianjost / .github_workflows_sync.yml
Created May 13, 2020 08:07
Example: Files Sync Action - simple
name: Sync
'on':
schedule:
- cron: '0 3 * * *'
push:
branches:
- master
jobs:
files:
name: Files
@adrianjost
adrianjost / aliases.config.js
Last active January 31, 2020 11:17
NuxtJS Theming - Component aliases with theming - https://medium.com/p/2567ef5b5b6a
const glob = require("glob");
const path = require("path");
// returns a list of all filepaths in a given directory
const readDirRecursiveSync = dir => {
return glob.sync(`${dir}/**/*.*`);
};
const getThemeAliases = (dir, theme) => {
const themeFilesDir = `src/themes/${theme}/${dir}`;
@adrianjost
adrianjost / aliases.config.js
Last active January 31, 2020 11:17
NuxtJS Theming - Component Alias - https://medium.com/p/2567ef5b5b6a
const path = require("path");
const aliases = {
// required to not break nuxt
"@": "src",
"@@": ".",
// custom aliases
"@components": "src/components",
}
@adrianjost
adrianjost / ExtendedRenderHtml.vue
Last active November 25, 2019 17:37
How to extend the RenderHtml.vue
<script>
import RenderHtml from "./RenderHtml.vue";
import FancyButton from "@components/FancyButton.vue";
export default {
components: {
FancyButton,
},
...RenderHtml,
};
</script>