Skip to content

Instantly share code, notes, and snippets.

@w35l3y
w35l3y / script.js
Last active August 2, 2019 15:45
Informações referentes ao script em execução
function Script () {
Object.defineProperties(this, {
debug: {
value: /\s+@debug\s+true$/m.test(GM_info.scriptMetaStr),
writable: false
}
});
}
@w35l3y
w35l3y / script-logger.js
Created August 2, 2019 15:31
Estrutura genérica para tratamento de log
// depends on https://gist.github.com/w35l3y/07442c6adf297703ac7915526a980134
function Logger (script) {
var debug = script.debug;
this.debug = function () {
if (debug) {
console.debug.apply(null, arguments);
alert(Array.prototype.slice.apply(arguments).join("\n\n"));
}
@w35l3y
w35l3y / ViewStateSessionHandler.js
Last active February 14, 2022 17:35
Mantém e manipula requisições relacionadas ao ViewState
/**
* Depends on
* https://gist.github.com/w35l3y/1d4e5578f7ce9d2a3d434729585defa6/
* https://github.com/w35l3y/userscripts/raw/master-greasemonkey/includes/Includes_HttpRequest/
*/
function Session (errorFn) {
logger.info("Sessão iniciada.");
var dvs = document.querySelector("input[name = 'javax.faces.ViewState']");
@w35l3y
w35l3y / mcdSync.md
Last active December 28, 2019 02:42
SmartThings snippets
@w35l3y
w35l3y / alexa_reject.yaml
Last active July 31, 2023 14:52
Alexa Intents - Main file is "examples_request.yaml"
>-
{%- set response = states("input_text.alexa_custom_skill_notification_response_rejected") -%}
{%- set text = (response if response else [
"Tudo bem",
"OK"
] | random) if states("input_text.alexa_custom_skill_notification_event_id") else "Negativo" -%}
{{- "<speak>%s</speak>" % (("<amazon:effect name=\"whispered\">%s</amazon:effect>" % text) if (as_timestamp(today_at()) <= as_timestamp(now()) <= as_timestamp(today_at("08:30:00"))) else text) }}
@w35l3y
w35l3y / automations.yaml
Last active July 31, 2023 23:21
Lembretes recorrentes através da integração do Home Assistant com Alexa
# Todas estas automações são genéricas e não precisam entender no detalhe, só se quiser realizar algum ajuste
# Executa entre 09h30 e 20h00 caso surja lembretes pendentes
- alias: Monitora lembretes recorrentes pendentes
description: 'Monitora a situação dos lembretes e executa a fala da Alexa para o 1º lembrete pendente da lista'
trigger:
- platform: state
entity_id:
- sensor.lembretes_recorrentes_pendentes
not_to:
- unavailable