Skip to content

Instantly share code, notes, and snippets.

Support Codes
import {
FaCamera,
FaFire,
FaHome,
FaPaintBrush,
FaVideo,
} from "react-icons/fa";
import { v4 as uuidv4 } from "uuid";
@SgtBatten
SgtBatten / frigate_0.11_notification.yaml
Last active December 7, 2023 20:09 — forked from hunterjm/frigate_0.10_notification.yaml
Frigate Notifications have moved
blueprint:
name: Frigate Notifications by SgtB have moved
description: |
## ANNOUNCEMENT
I have moved from this gist to a github repositry.
Please checkout https://github.com/SgtBatten/HA_blueprints for the latest versions
domain: automation
@neilio
neilio / switch-apps.applescript
Created May 4, 2022 13:30
Set up laptop for work
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Switch to FreshBooks
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
@drewkerr
drewkerr / get-focus-mode.js
Last active April 23, 2024 12:34
Read the current Focus mode on macOS Monterey (12.0+) using JavaScript for Automation (JXA)
const app = Application.currentApplication()
app.includeStandardAdditions = true
function getJSON(path) {
const fullPath = path.replace(/^~/, app.pathTo('home folder'))
const contents = app.read(fullPath)
return JSON.parse(contents)
}
function run() {
version: '2'
services:
mauticdb:
image: percona/percona-server:5.7
container_name: mauticdb
volumes:
- mysql_data:/var/lib/mysql
environment:
@clairechabas
clairechabas / index.js
Created May 9, 2020 20:17
File upload API endpoint handling uploads to Firebase Cloud Storage | #NodeJS #ExpressJS #Multer #Firebase #GCloudStorage #GCP
require('dotenv').config();
const express = require('express');
const app = express();
const cors = require('cors');
const bodyParser = require('body-parser');
const { Storage } = require('@google-cloud/storage');
const multer = require('multer');
const port = process.env.API_PORT || 8080;
app.use(bodyParser.json());
@chris-sev
chris-sev / setup.sh
Last active February 10, 2024 03:17
Mac Setup
# how to run this thingy
# create a file on your mac called setup.sh
# run it from terminal with: sh setup.sh
# heavily inspired by https://twitter.com/damcclean
# https://github.com/damcclean/dotfiles/blob/master/install.sh
# faster dock hiding/showing (run in terminal)
# defaults write com.apple.dock autohide-delay -float 0; defaults write com.apple.dock autohide-time-modifier -int 0;killall Dock
@andywer
andywer / _readme.md
Last active March 7, 2024 05:52
React - Functional error boundaries

React - Functional error boundaries

Thanks to React hooks you have now happily turned all your classes into functional components.

Wait, all your components? Not quite. There is one thing that can still only be implemented using classes: Error boundaries.

There is just no functional equivalent for componentDidCatch and deriveStateFromError yet.

Proposed solution

@lordneon
lordneon / steps.md
Last active April 26, 2024 09:58
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

module.exports.requestUploadURL = (event, context, callback) => {
var s3 = new AWS.S3();
var params = JSON.parse(event.body);
var s3Params = {
Bucket: 'slsupload',
Key: params.name,
ContentType: params.type,
ACL: 'public-read',
};