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"]) {
@mbentley
mbentley / omada_api.ps1
Last active August 9, 2024 13:55
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 August 27, 2024 13:44
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 September 22, 2024 23:30
Conventional Commits Cheatsheet

Conventional Commit Messages

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 September 9, 2024 06:05
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

@johnny5th
johnny5th / svg_img_load.js
Created September 19, 2018 19:22
SVG Image Loading
// SVG Masked Images
var masked_images = document.querySelectorAll('.svg-masked-image');
var changeHref = function(path, img_wrapper) {
var image = img_wrapper.querySelector('svg g image');
image.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path);
};
for(let i = 0; i < masked_images.length; i++) {
let img = masked_images[i].querySelector('img');