Skip to content

Instantly share code, notes, and snippets.

Avatar
👷‍♂️
Making

Cody Gagnon codycodes

👷‍♂️
Making
View GitHub Profile
@codycodes
codycodes / hue-remote-dimmer-december-2021.yaml
Last active May 20, 2022
Blueprint to create Home Assistant automations based on Hue Remote Dimmer Button Press/Holds (created using the RWL020 dimmer)
View hue-remote-dimmer-december-2021.yaml
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
View upstairs_den_bedroom_bed.yaml
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 Mar 11, 2021
Stenography Number Keys Memorizer
View steno_number_keys_memorizer.py
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 Mar 11, 2021
Stenography Layout Memorizer
View steno_keys_memorizer.py
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 Sep 24, 2020
Automator Service which allows you to easily find/replace all occurrences of selected text via Python
View macOS Automator Universal Find + Replace.md

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 Jan 15, 2020
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
View Some Trello Keyboard Shortcuts
// ==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==
View bulb.js
//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
View base.js
// 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 Jul 19, 2019
USB switch hacking!
View usb_switch.ino
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
Send a request to IFTTT with JSON data via an HTML form
View test_waitlist.html
<!--
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