Skip to content

Instantly share code, notes, and snippets.

View csrui's full-sized avatar
🏠
Working from home

Rui Sardinha csrui

🏠
Working from home
View GitHub Profile
@warrenp11
warrenp11 / hexadecimal-regex.md
Last active September 26, 2022 10:57
Hexadecimal Color Code Validation Using Regular Expression

Regex Tutorial: Validating a Hexadecimal Color Code

The following documentation will attempt to explain the components of regular expressions (regex) and how they are used for many purposes, one of which is to validate a hexadecimal color code.

Summary

The following regex is used when validating a hexadecimal color code:

    /^#?([0-9a-f]{6}|[0-9a-f]{3})$/i
@sbyx
sbyx / wake-up-light-alarm-with-sunrise-effect.yaml
Last active May 3, 2024 06:36
Home Assistant Blueprint: Wake-up light alarm with sunrise effect
blueprint:
name: Wake-up light alarm with sunrise effect
description: 'A wake-up light alarm with a brightness and color temperature sunrise
effect. Note: Requires date_time_iso sensor in configuration, not manually executable!'
domain: automation
input:
light_entity:
name: Wake-up light entity
description: The light to control. Turning it off during the sunrise will keep
it off. Color temperature range is auto-detected.
@sbyx
sbyx / notify-or-do-something-when-an-appliance-like-a-dishwasher-or-washing-machine-finishes.yaml
Last active April 10, 2024 15:09
Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
blueprint:
name: Appliance has finished
description: Do something when an appliance (like a washing machine or dishwasher)
has finished as detected by a power sensor.
domain: automation
input:
power_sensor:
name: Power Sensor
description: Power sensor entity (e.g. from a smart plug device).
selector:
@jazzyisj
jazzyisj / package_unavailable_entities.yaml
Last active February 2, 2024 12:31
Unavailable Sensor Detection and Notification
#######################################################################################################################
# The Unavailable Entities Sensor Package has been moved to it's own repository!
# https://github.com/jazzyisj/unavailable-entities-sensor
#######################################################################################################################
@doino-gretchenliev
doino-gretchenliev / configuration.yaml
Last active November 10, 2023 04:08
Home Assistant RADIUS authentication #home-assistant #homeassistant #radius #authentication #python
homeassistant:
auth_providers:
- type: command_line
command: "/config/auth/radius-auth.sh"
meta: true
@ciotlosm
ciotlosm / Readme.md
Last active February 5, 2024 15:04
Kiosk mode for lovelace

Kiosk mode

Installation

Add kiosk.js file with the content below to your www folder in config.

Like any other custom script, use ui-lovelace.yaml resources section to reference the kiosk.js file.

Make sure you add kiosk somewhere in your URL. You can use it in the id of your view or in the query string.

@mtask
mtask / ublocaldns.txt
Created August 19, 2017 09:38
Disable local dns ubuntu
Source: https://askubuntu.com/questions/907246/how-to-disable-systemd-resolved-in-ubuntu
Disable the systemd-resolved service and stop it:
sudo systemctl disable systemd-resolved.service
sudo service systemd-resolved stop
Put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:
dns=default
Delete the symlink /etc/resolv.conf
@cliffordp
cliffordp / functions.php
Last active September 13, 2017 03:36
Recurring events in wp-admin: only display first (parent) occurrence in list of Events (i.e. hide child recurring events)
<?php
/*
* Recurring events in wp-admin: only display first (parent) occurrence in list of Events
* (i.e. hide child recurring events)
*
* From https://theeventscalendar.com/knowledgebase/hide-recurring-event-instances-in-admin/
* - https://gist.github.com/cliffordp/81f23a207ab483c9e7c6d910f9b29c0a
* 2016-07-04 Barry shared this snippet from a previous customer's own/shared customization
*
@pascalbaljet
pascalbaljet / imagick-3.4.0-PHP7-forge.sh
Last active November 26, 2020 09:10
Install Imagick 3.4.0 on PHP 7.0 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.0.tgz
tar xvzf imagick-3.4.0.tgz
@helderco
helderco / db-open
Created October 6, 2015 14:51
Script to open a mysql database in Sequel Pro from a service in docker-compose.
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.