Skip to content

Instantly share code, notes, and snippets.

View MACscr's full-sized avatar

Mark Chaney MACscr

View GitHub Profile
@MACscr
MACscr / countdown-to-date-card.js
Created August 5, 2020 10:03
Home Assistant Countdown Card
class CountdownToDateCard extends HTMLElement {
constructor() {
super();
this.attachShadow({
mode: 'open'
});
}
setConfig(config) {
if (!config.target_date) {
@MACscr
MACscr / configuration.yaml
Created July 8, 2020 19:56
iframe-fullscreen
panel_custom:
- name: iframe-fullscreen
module_url: "/local/iframe-fullscreen.js"
sidebar_title: 'NZBGet'
url_path: ha-nzb
sidebar_icon: mdi:movie-search
config:
url: "https://XXXXXX.duckdns.org:8843/nzb/"
@MACscr
MACscr / sensor.py
Created July 8, 2020 19:22
Updated custom_components/fitbit/sensor.py to handle multiple accounts
"""Support for the Fitbit API."""
import datetime
import logging
import os
import time
from fitbit import Fitbit
from fitbit.api import FitbitOauth2Client
from oauthlib.oauth2.rfc6749.errors import MismatchingStateError, MissingTokenError
import voluptuous as vol
@MACscr
MACscr / attribute-pie-chart-card.js
Last active December 9, 2020 23:25
home assistant pie chart that works with static attribute values
/*
attribute: energy_percent_by_applicance
chart_type: doughnut
display_legend: false
entity: sensor.fpl_xxxxxxxxxx
legend_position: right
title: Power Distribution
type: 'custom:attribute-pie-chart-card'
*/
@MACscr
MACscr / master-bath-fan.yaml
Last active December 1, 2023 01:43
esphome treatlife_SS01S
esphome:
name: master_bath_fan
platform: ESP8266
board: esp01_1m
wifi:
ssid: "#######"
password: "#######"
# Enable fallback hotspot (captive portal) in case wifi connection fails
#!/bin/bash
# good idea to add the new serers ip to csf.ignore on the old server so you dont get a notification for every login
# server you are syncing email from
old_server='cp2.oldserver.com'
# formatted to easily be copied and pasted from "Show Reseller Accounts" in WHM
test_accounts='user1 user1.com basic_plan
user2 user2.com basic_plan'
# open firewall for remote access from select hosts
- hosts: localhost
gather_facts: no
tasks:
- name: Create redis firewall group
local_action:
module: vultr_firewall_group
name: redis
run_once: yes
@MACscr
MACscr / php.yml
Created September 19, 2019 10:20
initial php playbook attempt for apnscp's php-fpm. incomplete.
# apnscp php
- hosts: apnscp
tasks:
- name: set php-fpm to use by default with new accounts
shell: cpcmd scope:set apnscp.config httpd use_fpm true
- name: 01-imagick.ini check
file:
path: /home/virtual/FILESYSTEMTEMPLATE/siteinfo/etc/php72.d/01-imagick.ini
@MACscr
MACscr / email.php
Created September 13, 2019 18:40
/usr/local/apnscp/lib/modules/surrogates
<?php declare(strict_types=1);
use Opcenter\Dns\Record;
class Email_Module_Surrogate extends Email_Module
{
public function get_records(string $domain, string $subdomain = ''): array
{
$base = parent::get_records($domain, $subdomain);
// record to replace
@MACscr
MACscr / northwoods_events.php
Last active September 4, 2019 22:23
Trying to create this shortcode to get results from program_ids (can be multiple), then order the results by date, then group by series id if it has one, then limit number of results to whatever limit is specified.
<?php
function northwoods_events_shortcode($atts) {
$limit = 10;
if ($atts['limit']) {
$atts['limit'] = (int)$atts['limit'];
}
$args = array(