Skip to content

Instantly share code, notes, and snippets.

View codycodes's full-sized avatar
😀

Cody Gagnon codycodes

😀
View GitHub Profile
@codycodes
codycodes / hue-remote-dimmer-december-2021.yaml
Last active November 10, 2024 11:31
Blueprint to create Home Assistant automations based on Hue Remote Dimmer Button Press/Holds (created using the RWL020 dimmer)
blueprint:
name: Hue Dimmer Remote
description: |
(Dec 2021 Update) Using a Hue bridge with which a dimmer remote is paired, allows you to configure actions based on said Hue Dimmer Remote
NOTE: tested with RWL020 and RWL022, but community says it also works with RWL021!
domain: automation
source_url: https://gist.github.com/codycodes/f051781c35cfdfee15162ff680c9cbd8
input:
dimmer_device:
name: Dimmer Remote Device
esphome:
name: upstairs_den_bedroom_bed
platform: ESP32
board: esp32doit-devkit-v1
sensor:
# Bed
- platform: adc
id: bedside_sensor
pin: GPIO32
@codycodes
codycodes / steno_number_keys_memorizer.py
Last active March 11, 2021 16:42
Stenography Number Keys Memorizer
keys = "OSTPHAFPLT".lower()
i = 0
while i < len(keys):
currentLetter = input(f'What is the {i} key for the steno number order?: ').lower()
if currentLetter == keys[i]:
i += 1
else:
print(f"Sorry, that's incorrect! Currently we have: {keys[:i].upper()}")
@codycodes
codycodes / steno_keys_memorizer.py
Last active March 11, 2021 16:43
Stenography Layout Memorizer
keys = "#STKPWHRAO*EUFRPBLGTSDZ".lower()
i = 0
while i < len(keys):
currentLetter = input(f'What is the {i} key for the steno order?: ').lower()
if currentLetter == keys[i]:
i += 1
else:
print(f"Sorry, that's incorrect! Currently we have: {keys[:i].upper()}")
@codycodes
codycodes / macOS Automator Universal Find + Replace.md
Last active September 24, 2020 17:13
Automator Service which allows you to easily find/replace all occurrences of selected text via Python

Steps to setup:

  1. Download the file " universal_find_replace.zip" and unzip it (you can do unzip universal_find_replace.zip in the Terminal or right-click and decompress from the GUI.
  2. Click the Universal Find + Replace. and install it
  3. Set a keyboard shortcut to invoke it, or use the Services dropdown by right-clicking after selecting some text (see image below for the preference pane).

NOTE: Safari 14 broke the functionality to "Output replaces selected text"; therefore this script uses a workaround of copying the output to the clipboard. As of today, you'll then need to paste this back in on Safari 14; it will automatically replace the text in other apps. See this link for more info.

@codycodes
codycodes / Some Trello Keyboard Shortcuts
Last active January 15, 2020 20:03
Allows you to use the keyboard shorcuts in the comments to manipulate hiding/showing the calendar and going to its today view as well as starting/stopping pomodone if you use it
// ==UserScript==
// @name Some Trello Keyboard Shortcuts
// @namespace https://cody.codes
// @version 0.1
// @description Allows you to use the keyboard shorcuts in the comments to manipulate hiding/showing the calendar and going to its today view as well as starting/stopping pomodone if you use it
// @author You
// @match https://trello.com/b/*
// @grant none
// ==/UserScript==
//bulb.js
input.onGesture(Gesture.Shake, function () {
// This IF is satisfied only after connecting and
// disconnecting the bulb from the base, then shaking
// the bulb. This results in the bulb only going back
// to white after it's been connected to the base, as
// it's not a value inside "shake colors"
if (shake_after_connect == 1) {
light.setAll(0xffffff)
shake_after_connect = 0
@codycodes
codycodes / base.js
Last active December 10, 2019 04:23
// base.js
let item = 0
let must_reset = 0
let reset_photon = 0
pins.A3.setPull(PinPullMode.PullUp)
let brightness = 120
light.setAll(0xffffff)
forever(function () {
// I love this software hack! When using the Photon
// module (which is a Turtle which can draw lights on
@codycodes
codycodes / usb_switch.ino
Last active July 19, 2019 00:36
USB switch hacking!
int relayPin = 5; // red
int usbDetectPin = 6; // green
int button = 7; // purple -> blue/white
void setup() {
// put your setup code here, to run once:
pinMode(relayPin, INPUT);
pinMode(usbDetectPin, INPUT); //
// pinMode(button, OUTPUT); // TODO: we may want this button to be an input
// if we want to read its data for debugging
@codycodes
codycodes / test_waitlist.html
Created May 28, 2019 18:06
Send a request to IFTTT with JSON data via an HTML form
<!--
Copyright © 2019 Cody Antonio Gagnon
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE