Skip to content

Instantly share code, notes, and snippets.

View bbbenji's full-sized avatar
🛸
Hello, Earth!

Benji bbbenji

🛸
Hello, Earth!
View GitHub Profile
@bbbenji
bbbenji / add_ftp_users.sh
Last active August 29, 2015 14:24 — forked from janxb/ajenti_additional_ftp_users.sh
Additional FTP users for Ajenti
#!/bin/bash
SET_USERS="usernameone:password:/path/to/web/folder usernametwo:password:/path/to/second/folder"
IFS=' ' read -a USERS <<< "${SET_USERS}"
for SET_USER in ${USERS[@]}; do
IFS=':' read -a USER <<< "${SET_USER}"
NAME=${USER[0]};
PASS=${USER[1]};
DIR=${USER[2]};
(echo $PASS; echo $PASS) | pure-pw useradd $NAME -u www-data -g www-data -d $DIR
#Custom configuration
SMTP_PORT == 25:587
LOCAL_INTERFACES == <; 0.0.0.0.25 ; 0.0.0.0.587 ; 0.0.0.0.465 ; [::0]:25 ; [::0]:587 ; [::0]:465
smtp_accept_max = 50
spamd_address = 127.0.0.1 783
ACL_SMTP_DATA == acl_custom_check_data
USE = "exiscan"
#Custom ACLs
# Airly
- platform: rest
scan_interval: 120
name: Airly
resource: !secret airly_resource
value_template: "{{ value_json['current']['values'][1]['value'] }} {{ value_json['current']['values'][2]['value'] }} {{ value_json['current']['values'][3]['value'] }} {{ value_json['current']['values'][4]['value'] }} {{ value_json['current']['values'][5]['value'] }} {{ value_json['current']['indexes'][0]['level'] }}"
headers:
apikey: !secret airly_apikey
- platform: template

Here's the canonical TOML example from the TOML README, and a YAML version of the same. Which looks nicer?

title = "TOML Example"

[owner]

@bbbenji
bbbenji / bootstrap-4-cardinal-direction-range-input.markdown
Last active August 28, 2019 08:52
Bootstrap 4 cardinal direction range input

Bootstrap 4 cardinal direction range input

Range input for selecting cardinal direction and outputting degrees from north using Bootstrap custom-range input and native JavaScript.

A Pen by Benji on CodePen.

License.

import { LitElement, html } from 'https://unpkg.com/@polymer/[email protected]/lit-element.js?module';
const styles = html`
<style>
:host {
display: flex;
flex: 1;
flex-direction: column;
}
ha-card {
# GPIO0
# GPIO1
# GPIO2
# GPIO3 Button middle
# GPIO4 Button left
# GPIO5 Button right
# GPIO12 Relay/LED red left
# GPIO13 LED green (all)
# GPIO14 Relay/LED red middle
# GPIO15 Relay/LED red Right
@bbbenji
bbbenji / set_climate_on_time.yaml
Last active December 30, 2021 23:38 — forked from quallenbezwinger/set_climate_on_time.yaml
Set thermostat temperature at specific time - homeassistant blueprint
blueprint:
name: Set thermostat temperature at specific time
description: Sets a climate entities to a specifc temperature at a set time everyday. If climate entity is off, it is normally not accepting temperature updated. This blueprints checks if climate entity is off and the temperature update will be set when thermostat is going back in heating mode.
domain: automation
source_url: https://gist.github.com/bbbenji/059c16e9aa4bcec21f77d52f0dbac320
input:
persons:
name: Persons
description: Select the persons to be home.
default: {entity_id: []}
function checkout_datalayer($order_id) {
// Get the order
$order = wc_get_order($order_id);
// Get products from order
$products = $order->get_items();
?>
<script >
zaraz.ecommerce('Order Completed', {
'order_id': '<?php echo $order->get_order_number(); ?>',
'affiliation': 'Website',