Skip to content

Instantly share code, notes, and snippets.

View jamesridgway's full-sized avatar

James Ridgway jamesridgway

View GitHub Profile
import asyncio
import logging
import sys
import pyinotify
# Configure the logger
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
console_handler = logging.StreamHandler(sys.stdout)
alias: Ensuite Lights Off
description: ""
mode: single
trigger:
- platform: mqtt
topic: "shellies/shellyix3-FE9DE4D4101F/input/0"
condition:
- condition: template
value_template: "{{ trigger.payload == '0' }}"
- condition: device
alias: Ensuite Fan - On
description: ""
mode: single
trigger:
- platform: mqtt
topic: "shellies/shellyix3-FE9DE4D4101F/input/0"
condition:
- condition: time
after: "07:00:00"
before: "22:15:00"
alias: Ensuite Lights Off
description: ""
mode: single
trigger:
- platform: mqtt
topic: "shellies/shellyix3-FE9DE4D4101F/input/0"
condition:
- condition: template
value_template: "{{ trigger.payload == '0' }}"
- condition: device
alias: Ensuite Lights On
description: ""
mode: single
trigger:
- platform: mqtt
topic: "shellies/shellyix3-FE9DE4D4101F/input/0"
condition:
- condition: template
value_template: "{{ trigger.payload == '1' }}"
- condition: device
@jamesridgway
jamesridgway / git-cloning-with-a-different-ssh-key.md
Created August 13, 2021 09:29
Cloning with a different SSH key

Use-case

You need to use an SSH key to authenticate against a service which isn't your default SSH key, and/or your default key may be used on another (different) accout for the service.

Solution

  1. Clone the repo

    GIT_SSH_COMMAND='ssh -i ~/.ssh/your-private-key-filename -o IdentitiesOnly=yes' git clone git@....
    
@jamesridgway
jamesridgway / dns.sh
Created May 29, 2021 09:32
Ubuntu 20.04 DNS Resolution
# Installing resolvconf in Ubuntu
sudo apt update
sudo apt install resolvconf
# Start
sudo systemctl start resolvconf.service
sudo systemctl enable resolvconf.service
sudo systemctl status resolvconf.service
# Edit Nameserver Entries
decks:
- serial_number: "PUT_YOUR_STREAM_DECK_SERIAL_HERE"
name: 'devdeck.decks.single_page_deck_controller.SinglePageDeckController'
settings:
controls:
- name: 'devdeck.controls.mic_mute_control.MicMuteControl'
key: 0
settings:
microphone: Scarlett Solo USB Digital Stereo (IEC958)
- name: 'devdeck.decks.volume_deck.VolumeDeck'
@jamesridgway
jamesridgway / mongoid-drop-all-collections.rb
Created February 11, 2021 08:35
Mongoid drop all collections - use with caution
Mongoid.default_client.collections.each(&:drop)
public class NotificationService
{
public void NewCustomer(Customer customer)
{
var msg = $"You have a new customer called: {customer.Name}";
var smpt = new SmtpClient("smtp.example.com", 25);
var smtpMessage = new SmtpMessag();
smtpMessage.Subject = "New customer";