Skip to content

Instantly share code, notes, and snippets.

View mdeweerd's full-sized avatar

MDW mdeweerd

  • France
View GitHub Profile
@mdeweerd
mdeweerd / addCodespellIgnores.sh
Last active January 22, 2024 10:45
Script to add ignored lines to codespell configuration
#!/bin/bash
#
# Script to add codespell exceptions to the ignores lines file.
#
# The file is named '...-lines-ignore' to make TAB expansion on the cli easier.
#
# The line in the ignore file must match the line in the source
# exactly.
#
# To clean up or create the ignored lines file, just do
@mdeweerd
mdeweerd / !README.md
Last active October 1, 2023 11:40
Monitor OPNsense internet connection

Monitor OPNsense internet connection

The WAN facing connection is sometime reinitialised and lost by the OPNsense server.

The solution is to monitor the WAN facing connection.

The script referenced above will try to restore the connetion by bringing the interface down and then up. If that does not work, it will issue a reboot of the system.

@mdeweerd
mdeweerd / fix-links.lua
Last active September 24, 2023 20:49 — forked from MyriaCore/fix-links.lua
How to use pandoc with gitlab markdown
@mdeweerd
mdeweerd / !README.md
Last active August 22, 2023 17:18
Scripts for Docker (on Windows)

Scripts

  • optimizeDocker.ps1: Powershell Script to optimize Docker Data File. Gets location from configuration file.
  • moveDocker.cmd: Script to move Docker Data File (out of default directory). Use as moveDockerData.cmd D:\DockerData. Permissions of the target directory should be set to allow access to the wsl process.

Note: The shebang is for cygwin.

@mdeweerd
mdeweerd / !README.md
Last active September 21, 2023 21:34
Monitor Email Service by Checking Incoming on IMAP Server

Purpose

This script is targeted to be part of a mechanism to monitor the proper operation of a system sending emails.

It checks that the IMAP Server received a message with a certain SUBJECT in the last TIMEOUT minutes.
If such a message is missing during the TIMEOUT time frame, it will send an email notification.

@mdeweerd
mdeweerd / lixee.py
Created December 4, 2022 13:18
Local ZHA quirk for Lixee v12
# A ajouter au répertoire de quirks défini dans la configuration (configuration.yaml):
# zha:
# enable_quirks: true
# custom_quirks_path: /config/zha_quirks
from zhaquirks.lixee.zlinky import *
from zigpy.profiles import zha
from zigpy.quirks import CustomCluster, CustomDevice
import zigpy.types as t
from zigpy.zcl.clusters.general import Basic, GreenPowerProxy, Identify, Ota, PowerConfiguration
@mdeweerd
mdeweerd / !README.md
Last active November 11, 2023 17:03
Screen/bash setup for Home Assistant "Terminal & SSH" add-on

Home Assistant "Terminal & SSH" screen configuration.

Purpose

  • Start gnu screen automatically when connecting interactively to Home Assistant (keep terminal session across connections).
  • Provide a status line in the terminal
  • Define some aliases
  • Automatically "re-install" after add-on upgrade (create symbolic links,
@mdeweerd
mdeweerd / renew_ssl_cert.yaml
Last active January 9, 2024 16:43 — forked from e28eta/renew_ssl_cert.yaml
Homeassistant Blueprint for SSL-Certificate renewal
---
blueprint:
name: Renew Let's Encrypt Certificate
description: Renew Certificate when due date is below given value
domain: automation
input:
cert_expiry_sensor:
name: Certificate Expiry Sensor
description: Sensor from the Certificate Expiry Integration (https://www.home-assistant.io/integrations/cert_expiry)
selector:
@mdeweerd
mdeweerd / automation1.yaml
Last active October 24, 2022 21:14
Quick implementation to call scripts from AppDaemon
---
alias: DemoScript1
description: ''
trigger:
- platform: time_pattern
minutes: '45'
hours: '1'
condition: []
action:
# Trigger script 1
@mdeweerd
mdeweerd / rc.local
Created May 25, 2022 17:57 — forked from dunkelstern/rc.local
iptables rules for vpn config
# for ISAKMP (handling of security associations)
iptables -A INPUT -p udp --dport 500 --j ACCEPT
# for NAT-T (handling of IPsec between natted devices)
iptables -A INPUT -p udp --dport 4500 --j ACCEPT
# for ESP payload (the encrypted data packets)
iptables -A INPUT -p esp -j ACCEPT
# for the routing of packets on the server
iptables -t nat -A POSTROUTING -j SNAT --to-source %IP% -o eth0
# internet access
iptables -t nat -A POSTROUTING -s 10.0.42.0/24 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT