Skip to content

Instantly share code, notes, and snippets.


Leo leoherzog

View GitHub Profile
leoherzog /
Created Jun 3, 2021
Google Apps Script Philips Hue Sunrise-Sunset Color Temperature Changer
// updates the color temp of a hue group throughout the day, from blue in the morning to orange in the evening.
// copy these three to three files in a new apps script project (,
// make a new hue remote app id (,
// copy the app id and secret onto lines 54 and 55 of,
// publish as a web app,
// go to the web app and authorize via oauth,
// run createBridgeUser() on the hue-oauth-stuff page,
// copy the new bridgeuser id onto line 15 of this page,
// change the groupname to the Hue group you want to change,
leoherzog /
Last active May 20, 2021
Export Classic Google Sites Attachments to Google Drive Folder
// Go to, click "New Project", copy and paste this code in, and click "▷ Run" in the toolbar
function run() {
let sites = SitesApp.getAllSites('');
console.log('Total number of sites: ' + sites.length);
sites = sites.filter(site => {
try {
leoherzog /
Last active Feb 23, 2021
Google Drive Folder Change Notifier
* This script checks a Google Drive folder for any new files and/or folders added to it, and emails you if there are changes!
* To get started:
* 1. Go to and log in as the user that you want to do the automated "checking".
* 2. Click "New Project".
* 3. Rename the project at the top from "Untitled project" to something else (ex. "Folder Change Notifier") and copy/paste this code over the default "myFunction" stuff that's currently there.
* 4. Add the folder IDs to the "foldersToCheck" array on line 16 below, in quotes, comma-separated. It should look something like:
* const foldersToCheck = ["1J5d673365fd944334be51d4163cd8294d", "1c5d63119b730c8224a218222e5faedcad"];
* 5. Add the email address that you want to notify for when there's changes on line 18 below. It should look something like:
* const emailToNotify = "";
leoherzog /
Created Sep 25, 2020
Google Drive Photocopier - Make lots of copies of a file in Drive
// (copy this into a new Apps Script project -
// Hello!
// To make lots of copies of a thing in Google Drive,
// put the ID or URL of the Google Drive file here:
var fileToCopy = "";
// Quotes are important! Example:
// var fileToCopy = "";
leoherzog / *
Created Sep 1, 2020 Wunderground Temperature Scale
View * Wunderground Temperature Scale

  1. Go to
  2. Open the ☰ left sidebar and click Settings
  3. Scroll down and click 🎨 Customize color scale
  4. Select Temperature from the dropdown and scroll down to the small Import/Export section. Click [View Code].
  5. Paste the code from below into the text box on the page and click Save.

You're done!

leoherzog / *
Last active Dec 27, 2019
Google Drive TVDB Video Renamer
View *

Google Drive TVDB Video Renamer

Google Apps Script code to go through a folder in Google Drive, recursively find all of the video files, and based off of the file names, rename them all to be consistent via information from The TVDB.


  1. Copy the two .gs files from this repo into a new Google Apps Script project
  2. Change the folder ID in the quotes in line 1 to the Google Driue folder ID that contains the video files (that can be found in the URL when opening the folder)
  3. Change the name of the show in the quotes on line 2 to be the name of the show
  4. Create a free account at the TVDB to obtain an API key. Get your API key information and copy it into line 84.
  5. Run the "run" function (and grant OAuth permissions if necessary)
leoherzog /
Created Feb 20, 2019
Add All Google Contacts with a Phone Number to a Label
var nameOfLabel = "Contacts With a Phone Number";
function run() {
var label = ContactsApp.getContactGroup(nameOfLabel);
if (!label) {
label = ContactsApp.createContactGroup(nameOfLabel);
var allContacts = ContactsApp.getContacts();
leoherzog / callsigns.js
Last active Jan 17, 2019
Amateur (Ham) Radio US Vanity Callsign Rules for Javascript
View callsigns.js
String.prototype.isValidCallsign = function() {
const sign = this.toString().toUpperCase().trim();
// quick obvious check that might save time in large sets
if (sign.length < 3 || sign.length > 6) {
return false;
// the general structure of the us callsign
var validSign = /^[AKNW][A-Z]?[0-9][A-Z]{1,3}$/;
if (!validSign.test(sign)) {
leoherzog /
Created Feb 27, 2018
[Google Apps Script] Change Owner of Google Drive Folder and All It's Contents
var allFolders = [];
var allFiles = [];
function changeOwnership() {
var newOwner = "";
var folderIdToChange = "0B7uECGWKsTGu712INmZSYzReSBE";
// update the global allFiles and allFolders arrays
leoherzog / *Custom Printer
Last active May 23, 2018
Leo's IIIP Monoprice Maker Select Plus Cura 3.1 Config Files
View *Custom Printer

Custom Printer Settings

Printer Settings

  • X (Width): 200
  • Y (Depth): 200
  • Z (Height): 160

Build Plate Shape: Rectangular

  • Origin at center
  • Heated bed