Skip to content

Instantly share code, notes, and snippets.

@tanaikech
tanaikech / submit.md
Last active August 16, 2024 10:22
Comparing File Contents of Files on Google Drive using Google Apps Script

Comparing File Contents of Files on Google Drive using Google Apps Script

This is a sample script for comparing the file contents of files on Google Drive using Google Apps Script.

Sample script

Before you use this script, please enable Drive API at Advanced Google services. And also, please set the file IDs you want to check whether the file contents of the files are the same.

function checkFiles_(f, checks = ["md5Checksum", "sha1Checksum", "sha256Checksum"]) {
@Cadair
Cadair / thermostat.yaml
Last active November 23, 2024 22:32
esphome configuration for my Open Energy Monitor thermostat
# This is an esphome configuration file for the OpenEnergyMonitor Thermostat
# The primary objectives of this configuration file are:
# 1) The temperature used as the sensor for the thermostat should be read from
# homeassistant, this lets you use an average or change the room the
# temperature is based on depending on the time of day etc.
# 2) If homeassisant goes offline the thermostat keeps working.
# To this end there is a sensor "average_temperature" which is recieved from hass
# and a second sensor "combined_temperature" which decides based on if a device
# is connected to the native API or not to use this sensor or the local sensor
# attached to the thermostat.
@mbentley
mbentley / omada_api.ps1
Last active January 4, 2025 20:20
Example API Calls Using Powershell and Bash/curl for Omada Controller (last validated on 5.12.7)
### PowerShell Example
# set variables
$OMADA_URL = "https://omada.example.com:8043"
$USERNAME = "admin"
$PASSWORD = "test12345"
# get controller id from the API
$CONTROLLER_ID = (Invoke-RestMethod -Uri "${OMADA_URL}/api/info" -Method Get -UseBasicParsing).result.omadacId
# set the login request body as json
@PackeTsar
PackeTsar / byobu-ssh-cheatsheet.md
Last active February 9, 2025 10:53
Byobu (over SSH) Cheat Sheet

Byobu (over SSH) Cheat Sheet

I often find myself using Byobu on a Linux machine when connected to it over SSH. In doing so, I've noticed that many of the documented keyboard shortcuts don't work. This can be due to the native PC's OS intercepting certain keys, or possibly other reasons.

Below is a cheatsheet with Byobu features I have found usually work when run over a SSH connection.

Action Windows + Putty to Ubuntu MacOS + Terminal to Ubuntu
Help menu BASH: byobu-config FN-F1
Create new window CTRL-a c CTRL-a c or FN-F2
@akiya64
akiya64 / .gitlab-ci.yml
Created May 12, 2021 08:23
Backstopjs on GitLab CI and Pages
stages:
- get_reference
- regression_test
- publish
backstopjs_reference:
stage: get_reference
image:
name: backstopjs/backstopjs:latest
entrypoint: [""]
@niro1987
niro1987 / zha_ikea_tradfri_5button_remote_custom.yaml
Last active January 15, 2022 08:56
Home Assistant - Blueprint - ZHA - IKEA TRADFRI - 5 Button Remote - Custom Actions
---
# This automation simulates the use of the IKEA TRADFRI Remote control
# connected through ZHA.
blueprint:
source_url: https://github.com/niro1987/homeassistant-config/blob/main/blueprints/automation/niro1987/zha_ikea_tradfri_5button_remote_custom.yaml
name: ZHA - IKEA TRADFRI - 5 Button Remote - Custom Actions
description: >-
@m33x
m33x / hass.js
Last active September 17, 2024 12:21
Simple Home Assistant (HASS) iOS Widget via Scriptable App
let widget = await createWidget();
if (!config.runsInWidget) {
await widget.presentSmall();
}
Script.setWidget(widget);
Script.complete();
async function createWidget(items) {
@waako
waako / pre-commit
Created March 6, 2019 14:28 — forked from KeyboardCowboy/pre-commit
Check for Drupal Debugging Statements Before Committing Code
#!/bin/bash
#
# Check for debugging statements before commiting your code.
# Place this file in the .git/hooks directory of your project.
# List of function names to search for in regex format
FUNCTIONS='dpm|kpr|qpr|kint|dd|console\.log'
# If any functions are found as executable, prevent the commit.
DIEONFAIL=true
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active February 28, 2025 10:18
Conventional Commits Cheatsheet

Conventional Commit Messages starline

See how a minor change to your commit message style can make a difference.

Tip

Have a look at git-conventional-commits , a CLI util to ensure these conventions, determine version and generate changelogs

Commit Message Formats

Default

@lordneon
lordneon / steps.md
Last active February 21, 2025 14:26
UK Light Wiring with Shelly 1

Intro

This is a simple guide on how to automate UK lights with a Shelly 1 by installing the shelly 1 relay into the ceiling pendant which has both permanent live, neutral and a switched live back from the wall switch.

These steps are from my own experience making my lighting "smart" but also user friendly (it works via a wall switch!). This simple guide will go through replacing an a normal ceiling pendant with one with room for a Shelly 1. If you have a ceiling light with a bigger base it's even easier.

Warning Electrical regulations must be followed by law. If you are not a competent person under the regulations do not attempt electrical work. https://www.diydoctor.org.uk/projects/electrical_safety.htm

Wiring Diagram

This diagram has been taken from here and modified to include the Shelly 1. Wiring Diagram