Skip to content

Instantly share code, notes, and snippets.

View Belphemur's full-sized avatar

Antoine Aflalo Belphemur

View GitHub Profile
@Belphemur
Belphemur / heating_cable.yaml
Last active November 7, 2025 14:41
Home Assistant: Automatically controls roof heating cables based on temperature and weather conditions.
blueprint:
name: "Smart Roof Heating Cable Controller"
description: |
Automatically controls roof heating cables based on temperature and weather conditions.
**Features:**
• Fetches weather forecast data hourly and stores in helper
• Conservative activation logic (current conditions + imminent forecast)
• Temperature-based thresholds (day/night)
• Safety shutoff above maximum temperature
@Belphemur
Belphemur / circadian_light.yaml
Last active October 31, 2025 20:35
Circadian Light Home Assistant
blueprint:
name: "Circadian Motion Lighting - Smart Motion Logic"
description: >
**Version: 2.5.6 - Smart Motion Logic**
Motion/Occupancy/Presence-activated lighting with **smart conditional logic** and complete light therapy.
**NEW in 2.5.6: Smart Motion Detection**
@Belphemur
Belphemur / main.py
Last active March 13, 2024 10:44
Summarize Youtube Recipe video into text intruction with OpenAI ChatGPT and Whisper
from pytube import YouTube
from moviepy.editor import *
import openai
import textwrap
openai.api_key = "YOUR KEY"
def download_youtube_video(url, output_path):
yt = YouTube(url)
video = yt.streams.filter(file_extension='mp4').first()
video.download(output_path)
@Belphemur
Belphemur / DefaultKeyBinding.dict
Created September 2, 2022 19:28
DefaultKeyBinding.dict for MacOS to work like windows for Home/End and CTRL+Arrow functions
//source: https://damieng.com/blog/2015/04/24/make-home-end-keys-behave-like-windows-on-mac-os-x/
//Move DefaultKeyBinding.dict in your ~/Library/KeyBindings folder
//Log out log back in
{
"\UF729" = moveToBeginningOfParagraph:; // home
"\UF72B" = moveToEndOfParagraph:; // end
"$\UF729" = moveToBeginningOfParagraphAndModifySelection:; // shift-home
"$\UF72B" = moveToEndOfParagraphAndModifySelection:; // shift-end
"^\UF729" = moveToBeginningOfDocument:; // ctrl-home
"^\UF72B" = moveToEndOfDocument:; // ctrl-end
@Belphemur
Belphemur / http-wordpress-login-xmlrpc.yaml
Last active November 11, 2021 07:44
CrowdSec - Wordpress Login & XML RPC Scenario
type: leaky
format: 2.0
#debug: true
name: belphemur/http-wordpress-login-xmlrpc
description: "Detect attempt to access to wp-login and xmlrpc"
filter: "evt.Meta.log_type == 'http_access-log' && (evt.Parsed.file_name == 'wp-login.php' || evt.Parsed.file_name == 'xmlrpc.php') && evt.Parsed.verb == 'POST'"
groupby: "evt.Meta.source_ip"
#distinct: evt.Parsed.request
capacity: 4
leakspeed: 2m
@Belphemur
Belphemur / sandbox-winget.ps1
Last active July 17, 2023 00:32
Use Windows Sandboxing to be able to install your WinGet manifest. Source: https://megamorf.gitlab.io/2020/07/19/automating-the-windows-sandbox/
# Parse Arguments
Param(
[Parameter(Mandatory, HelpMessage = "The path for the Manifest.")]
[String] $Manifest
)
if (-not (Test-Path -Path $Manifest -PathType Leaf)) {
throw 'The Manifest file does not exist.'
}
@Belphemur
Belphemur / 10-nextdns-catchall.sh
Created March 11, 2021 14:55
NextDNS catch all UDM
#!/bin/sh
SERVICE_FILE=nextdns-catchall.service
SOURCE_FILE_PATH=/data/${SERVICE_FILE}
SYSTEMD_FILE_PATH=/etc/systemd/system/${SERVICE_FILE}
if [ ! -f $SOURCE_FILE_PATH ];
then
echo "Can't find service file"
exit 1
fi
@Belphemur
Belphemur / DeepDotKey.ts
Last active October 30, 2020 22:47
Deep generate dot notation in TypeScript with example
interface Hello {
foo : World;
bar: Number;
array: World[]
}
interface World {
greeting: string;
}
@Belphemur
Belphemur / nginx-proxy.conf
Last active March 6, 2021 18:59 — forked from ivanionut/nginx-proxy.conf
Proxy nginx to use Google Tag Manager
# Google Analytics Bypassing Adblockers
## Client
change www.googletagmanager.com => your.domain.com
```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://your.domain.com/gtag/js?id=UA-123456789-1"></script>
```
@Belphemur
Belphemur / .borg.conf
Created June 5, 2020 01:24
Borg Backup script
#!/bin/sh
REPOSITORY=_SERVER_:_PATH_
BORG_CMD="borg"
BACKUP_DIR="/"
BACKUP_OPTIONS="--compress zstd,8 -v"
BACKUP_PREFIX="ns2"
export BORG_PASSPHRASE="_PASS_PHRASE"
EXCLUDE="/proc /boot /dev /mnt /sys /tmp"