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)
@jamesridgway
jamesridgway / init.sh
Last active May 8, 2023 20:26
Packer Ubuntu 18.04 setup for Virtual Box and AWS AMI
set -e
echo "The user is: $SUDO_USER"
# System Updates
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -yq
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get upgrade -yq
@jamesridgway
jamesridgway / gtk.css
Created December 31, 2017 11:58
Reduce title bar size for applications in Gnome by creating ~/.config/gtk-3.0/gtk.css with the following contents
# Gnome 3 - based on https://blog.samalik.com/make-your-gnome-title-bars-smaller/
.header-bar.default-decoration {
padding-top: 3px;
padding-bottom: 3px;
font-size: 0.8em;
}
.header-bar.default-decoration .button.titlebutton {
padding: 0px;
}
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'