Skip to content

Instantly share code, notes, and snippets.

View codycodes's full-sized avatar

Cody Gagnon codycodes

View GitHub Profile
@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
@codycodes
codycodes / gmail_create_label_from_message_contacts.js
Last active March 10, 2019 03:00
Creates a defined label from contacts in a defined email which then can use said label to message that group of contacts.
/*
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 US
@codycodes
codycodes / change_raspberry_pi_hostname.sh
Last active January 9, 2019 11:42
Changes the hostname on your raspberry pi to what's set in $hostname (variable); can be passed in as a parameter or hard-coded into the script
#!/bin/bash
# see LICENSE file on this gist at gist.github.com/codycodes
# Requires root permissions. An easy way to run this script is to simply use "sudo bash change_raspberry_pi_hostname.sh"
# Changes the hostname on your raspberry pi to what's set in $hostname (variable)
# Can be passed in as a parameter by calling this script or set explicitly in this file
# Makes a backup of the hosts file (/etc/hosts.bak)
@codycodes
codycodes / toggle_menu_bar_macos.scpt
Last active January 9, 2019 11:41
-- Toggle "Automatically hide and show the menu bar option using UI" -- Useful for when you want to maximize your screen real estate :) -- Please comment if you have any suggestions for improvements!
-- Toggle "Automatically hide and show the menu bar option using UI"
-- Useful for when you want to maximize your screen real estate :)
-- Please comment if you have any suggestions for improvements!
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.General"
tell application "System Events"
delay 1
tell process "System Preferences"
@codycodes
codycodes / helper.gs
Created January 6, 2019 00:14
Google Apps Script Helper Functions for interacting with spreadsheet and Calendar
function getEvents(calId){
/*
Gets the events which occur in the next 24 hours for the given calendar ID
*/
cal = CalendarApp.getCalendarById(calId);
var now = new Date();
var twentyFourHoursFromNow = new Date(now.getTime() + (24 * 60 * 60 * 1000));
var events = cal.getEvents(now, twentyFourHoursFromNow);
return events;
}
@codycodes
codycodes / Make Google Calendar All-Day Events Draggable
Created January 5, 2019 21:50
Tampermonkey Script; Hacky. You can drag down all-day events into the calendar as normal events. Useful for me because I use Google Calendar all day events as a todo list and I like being able to just drag in the events. Updating secTimer will change how frequently the function that makes all day events draggable runs. Also respods to some key p…
// ==UserScript==
// @name Make Google Calendar All-Day Events Draggable
// @namespace https://calendar.google.com/calendar/*
// @version 0.1
// @description Hacky. You can drag down all-day events into the calendar as normal events. Useful for me because I use Google Calendar all day events as a todo list and I like being able to just drag in the events. Updating secTimer will change how frequently the function that makes all day events draggable runs. Also respods to some key presses. Still very much WIP
// @author Cody Antonio Gagnon
// @match https://calendar.google.com/calendar/*
// @grant none
// ==/UserScript==
@codycodes
codycodes / LICENSE
Created November 4, 2018 17:31
This license applies to all public gists https://gist.github.com/codycodes
MIT License
Copyright (c) 2018 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:
@codycodes
codycodes / TLR Input Optimizer
Created June 21, 2018 23:53
For the part-time employees of Seattle Central - take back your time spent using the TLR interface by using this optimized input script!
// ==UserScript==
// @name TLR Input Optimizer
// @namespace http://cody.codes
// @version 0.1
// @description For the part-time employees of Seattle Central - take back your time spent using the TLR interface by using this optimized input script!
// @author Cody Antonio Gagnon - codycodes
// @match https://apps.seattlecolleges.edu/TLR/Employee/TimeEntry.aspx*
// @require https://momentjs.com/downloads/moment.min.js
// @grant none
// ==/UserScript==