Researched by Robert Quattlebaum darco@deepdarc.com.
Last updated 2020-02-03.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import with_statement | |
from kombu import BrokerConnection | |
from collections import defaultdict | |
import gevent | |
from gevent import monkey | |
monkey.patch_all() | |
class WorkerHub(): | |
""" | |
WorkerHub controls the local mailboxes that the @worker decorator assigns. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models import Field | |
from django.conf import settings | |
from django.utils.decorators import cached_property | |
class VirtualField(object): | |
""" | |
A virtual field, mainly used for caching and seamless computed field retrieval. | |
This acts both like a (cached) property and a virtual field if supported. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MQTT broker configuration | |
mqtt: | |
broker: !secret mqtt_broker | |
username: !secret mqtt_username | |
password: !secret mqtt_password | |
discovery: False # Only if you use the HA API usually | |
id: mqtt_client | |
# Define the room for this ESP32 node | |
substitutions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Update notifications | |
description: Send notifications for new updates and install or skip on action | |
homeassistant: | |
min_version: '2022.4.0' | |
domain: automation | |
input: | |
update_entities: | |
name: Update entities | |
description: >- |
Services declared as oneshot
are expected to take some action and exit immediatelly (thus, they are not really services,
no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.
Let's create a example foo
service that when started creates a file, and when stopped it deletes it.
Create executable file /opt/foo/setup-foo.sh
:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
# Copyright (c) Rau Systemberatung GmbH (rausys.de) | |
# MIT License | |
# credits: https://pyimagesearch.com/start-here/ | |
import argparse | |
import os | |
from datetime import datetime, timedelta |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MasterProxy.Application do | |
alias MyApp.Endpoint, as: MyAppEndpoint | |
alias MyApp.UserSocket, as: MyAppUserSocket | |
alias MyOtherApp.Endpoint, as: MyOtherAppEndpoint | |
alias MyOtherApp.UserSocket, as: MyOtherAppUserSocket | |
alias Phoenix.LiveReloader.Socket, as: LiveReloadSocket | |
alias Plug.Cowboy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule DateTimeParser do | |
@mapping %{ | |
"H" => "(?<hour>\\d{2})", | |
"I" => "(?<hour12>\\d{2})", | |
"M" => "(?<minute>\\d{2})", | |
"S" => "(?<second>\\d{2})", | |
"d" => "(?<day>\\d{2})", | |
"m" => "(?<month>\\d{2})", | |
"y" => "(?<year2>\\d{2})", | |
"Y" => "(?<year>-?\\d{4})", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nginx conf for proxying the FreeIPA UI. ipa.my.org is the proxy name, realipa.my.org is the master. | |
server { | |
listen 443 ssl; | |
server_name ipa.my.org; | |
ssl on; | |
ssl_certificate /etc/nginx/ssl/ipa.crt; | |
ssl_certificate_key /etc/nginx/ssl/ipa.key; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
ssl_ciphers AES256+EECDH:AES256+EDH:AES128+EECDH!aNULL; |
NewerOlder