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
<?php | |
// This file defines the function lametricFormatNumber which accepts a filepath to an 8x8px PNG and string. | |
// The general idea is that an 8-digit number can be displayed on the LaMetric without scrolling by overlaying | |
// the left-most digit over the icon. By providing your desired icon PNG file(GIFs for animated icons not yet | |
// supported) and number to lametricFormatNumber, you will recieve as output your icon and number, with the first | |
// digit overlaid on the icon if the number has 8 or more digits. The alphabet A-Z is also included, however does not | |
// work as well, as the letters I, M, N, Q and W deviate from the 3-pixel width of all the other characters and digits. | |
// Theoretically, a 9-digit number could also be displayed as there is enough room on top of the icon, however then there | |
// won't be much room left for the actual icon, so it's not really worth it. At the end of this file is an example json | |
// output in LaMetric time format using the function. |
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/env python3 | |
# v0.4 Created by Tugzrida(https://gist.github.com/Tugzrida) | |
# Hook script for obtaining certificates through Certbot via Cloudflare DNS-01 challenge. | |
# Offers more flexibility for Cloudflare authentication than the certbot-dns-cloudflare plugin. | |
# Note that this script is not actively maintained or guaranteed to work consistently. | |
# Use in prod at your own risk and with adequate monitoring! | |
# Begin by listing the Cloudflare zones(domains) you with to obtain certificates for in the `zones` dict below, | |
# along with Cloudflare API tokens authorised to edit DNS on those zones. Also see the example dict for the CNAME setup option. |
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
# A simple Nginx vhost to direct all requests to mta-sts.example.com to the mta-sts file. | |
# Just substitute your domain and certificate paths(MTA-STS *must* be available over HTTPS) | |
# Then do mkdir -p /var/www/mta-sts/.well-known and add your policy to | |
# /var/www/mta-sts/.well-known/mta-sts.txt | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name mta-sts.example.com; |
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
/* uCollapse v0.2 Created by Tugzrida(https://gist.github.com/Tugzrida) */ | |
.ucollapsible { | |
overflow: hidden; | |
transition: height 0.3s ease-in-out; | |
} | |
.ucollapsible.ucollapsed { | |
height: 0px; | |
} |
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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
listen 443 ssl default_server; | |
listen [::]:443 ssl default_server; | |
## For nginx >= 1.19.4: | |
## If also using openssl >= 1.1.1j, the certificate directives can be removed. | |
## Even if present, the cert is never sent, it's just a workaround for an openssl bug. |
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
// This worker is designed to be able to neatly handle MTA-STS policies for multiple domains. | |
// Make a new worker with this script and add your domains to the stsPolicies dict like the example. | |
// Add a DNS AAAA record for mta-sts.yourdomain.com pointing to 100:: and set to proxied, | |
// then add a workers route for mta-sts.yourdomain.com/* pointing to this worker. | |
// You'll still need to manually add the appropriate _mta-sts.yourdomain.com TXT record to enable the policy, | |
// and the _smtp._tls.yourdomain.com TXT record for reporting. | |
const stsPolicies = { |
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
template: | |
- sensor: | |
- name: "Current power tariff" | |
unique_id: sensor.current_power_tariff | |
state: > | |
{% if now().weekday() not in (5, 6) and ( | |
(now().month in (11, 12, 1, 2, 3) and 14 <= now().hour <= 19) | |
or | |
(now().month in (6, 7, 8) and 17 <= now().hour <= 20) | |
)-%} |
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 | |
from urllib.request import urlopen, Request | |
from functools import cached_property | |
from datetime import timedelta, datetime, UTC | |
import dataclasses as dc | |
import glob, os, time, dropbox, tarfile, json, sys | |
###### | |
HA_TOKEN = "XXX" | |
HA_BACKUP_DIR = "/home/pi/docker/homeassistant/config/backups/" |
OlderNewer