Skip to content

Instantly share code, notes, and snippets.

blueprint:
name: Low Battery Notifications & Actions
description: >
# 🪫 Low Battery Notifications & Actions
**Version: 2.1**
🚀 Stay Charged, Stay Smart! Let's automate and take charge of your battery maintenance!🔋⚡
@Digi92
Digi92 / renew_ssl_cert.yaml
Last active May 6, 2024 21:50 — forked from TJ-developer/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:
entity:
@Digi92
Digi92 / CorsSubscriber.php
Last active December 18, 2023 22:58
Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony application. This event subscriber is used to handle CORS Preflight OPTIONS requests. It enables the application to accept requests from the domain specified in 'app.frontend_
<?php
declare(strict_types=1);
namespace App\Subscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
@Digi92
Digi92 / git
Last active September 28, 2022 15:21
Just replace `<AUTHORNAME>` with the person name you want to see
git log --author="<AUTHORNAME>" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'
AuthName "Protected Area"
AuthType Basic
AuthUserFile /path/to/your/.htpasswd
AuthGroupFile /dev/null
SetEnvIf Request_URI .* noauth
SetEnvIf Request_URI the_uri_you_want_to_protect !noauth
SetEnvIf Request_URI /another/uri/ !noauth
SetEnvIf Request_URI add_as_many_as_you_want !noauth
@Digi92
Digi92 / AdditionalConfiguration.php
Created July 29, 2019 09:07
Functionality to shorten beautiful URLs, like the RealUrl functions "user_encodeSpURL_postProc" and "user_decodeSpURL_preProc" This is a copy of https://gist.github.com/Nimmermaer/2feab3af3cc0fa8f5f79be64ebd00d20
<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['extensionkey']['UrlReplacements'] = [
'newsroom/presse/details/tx_news/' => 'newsroom/presse/',
'newsroom/aktuelles/details/tx_news/' => 'newsroom/aktuelles/',
'newsroom/veranstaltungskalender/details/tx_news/' => 'newsroom/veranstaltungskalender/'
];
@Digi92
Digi92 / FilterUrl
Created April 15, 2019 08:58
This function will remove all suspicious characters from a $_GET parameter. This has only a security reason. Source: https://stackoverflow.com/a/1886296
/**
* This function will remove all suspicious characters from a $_GET parameter
*
* @param $url
* @return array|string|string[]|null
*/
protected function filterUrl($url)
{
if (is_array($url))
{
<?php
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper;
/**
* The repository for ExampleRepository
*/
@Digi92
Digi92 / Remove segmentation information from translation
Last active January 18, 2019 10:02
TYPO3 won't use translation files with segmentation informations and they look like: <trans-unit id="example"> <source>Beispiel</source> <seg-source> <mrk mtype="seg" mid="108">Beispiel</mrk> </seg-source>
TYPO3 won't use translation files they look like:
<trans-unit id="example">
<source>Beispiel</source>
<seg-source>
<mrk mtype="seg" mid="108">Beispiel</mrk>
</seg-source>
<target state="final">
<mrk mtype="seg" mid="108">Example</mrk>
</target>
</trans-unit>
@Digi92
Digi92 / Steps
Created July 31, 2018 12:19
Das Entfernen umfasst sowohl das Löschen der VirtualBox-VM als auch der Vagrant-Boxen. Alle Befehle funktionieren nur, wenn man im Arbeitsverzeichnis des Projektes ist.
1. Feststellen des korrekten Namens der Box: vagrant status
2. Entfernen der VirtualBox-VM: vagrant destroy
3. Entfernen der Vagrant-Box: vagrant box remove <Box-Name aus Schritt 1>