Skip to content

Instantly share code, notes, and snippets.

blueprint:
name: Timed Motion-activated Light
description: Turn on a light when motion is detected within a certain time contraint.
domain: automation
input:
motion_entity:
name: Motion Sensor
selector:
entity:
domain: binary_sensor
@jerome-breton
jerome-breton / purge.sh
Last active September 20, 2019 16:36 — forked from vmassuchetto/purge.sh
Script to clean a Virtualbox VM before packaging it.
#!/bin/bash
# Run with:
# curl https://gist.githubusercontent.com/jerome-breton/d041dd70cc61fee6e70a1da0db9fad39/raw/purge.sh | sudo bash
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
# - https://gist.github.com/adrienbrault/3775253
# - https://gist.github.com/vmassuchetto/6225959
@jerome-breton
jerome-breton / youtube-played-remover-bookmarklet.js
Last active September 5, 2024 17:22
Bookmarklet for removing played items from your Youtube Playlist
/** Minified version with https://dotmaui.com/jsminify/
javascript:(()=>{let e=window.location,t=document;if("www.youtube.com"!=e.host&&"/playlist"!=e.pathname)return void alert("You must be in a Youtube playlist !");let n=t.createElement("div");n.style="position:fixed;z-index:2999;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.8);",t.body.appendChild(n);let o=new URLSearchParams(e.search),i=t.createElement("iframe");i.src=e.origin+e.pathname+"?"+o.toString(),i.style="display:none",i.sandbox="allow-same-origin allow-scripts allow-top-navigation allow-presentation";let r="("+(e=>{function t(e){return new Promise(t=>{let n;if(n=document.querySelector(e))return t(n);const o=new MutationObserver(i=>{(n=document.querySelector(e))&&(t(n),o.disconnect())});o.observe(document.body,{childList:!0,subtree:!0})})}function n(e,r,l){var a;if(e.length){let o=e.pop().closest("ytd-playlist-video-renderer");o.querySelector("#menu #button").click(),t("tp-yt-iron-dropdown:not([id=dropdown])").then(t=>{(a=t,new
@jerome-breton
jerome-breton / magerun.sh
Created February 18, 2019 15:06
Script for using a Magerun (1 & 2) over SSH as a Command Line Tool in PHPStorm
#!/bin/bash
#Script for using a Magerun (1 & 2) over SSH as a Command Line Tool in PHPStorm
#Usage :
# 1. Exchange SSH keys to allow passwordless connection
# 2. Update following vars to your env
REMOTE_USER="main"
REMOTE_HOST="magento2.local"
MAGERUN_PATH="php /usr/local/bin/n98-magerun2.phar"
MAGENTO_PATH="/var/www/html"