Skip to content

Instantly share code, notes, and snippets.

Avatar
😷
Masks are Kind

Leo leoherzog

😷
Masks are Kind
View GitHub Profile
@leoherzog
leoherzog / code.gs
Last active Feb 23, 2021
Google Drive Folder Change Notifier
View code.gs
/**
* 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 script.google.com 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 = "name@gmail.com";
@leoherzog
leoherzog / code.gs
Created Sep 25, 2020
Google Drive Photocopier - Make lots of copies of a file in Drive
View code.gs
// (copy this into a new Apps Script project - https://script.google.com/)
// 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 = "https://jamboard.google.com/d/1jwdBuEjFtGvAjaRIsxXkR-nm-EgL2cES8UGOjREvdj0/viewer";
//
// Quotes are important! Example:
// var fileToCopy = "https://docs.google.com/document/d/1TIDOiUpPiWNqKqduKlbtm2O4jgFIAPrxuz_JFWzod9s/edit?usp=sharing";
@leoherzog
leoherzog / *setup.md
Created Sep 1, 2020
Windy.com Wunderground Temperature Scale
View *setup.md

Windy.com Wunderground Temperature Scale

  1. Go to windy.com
  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
leoherzog / *README.md
Last active Dec 27, 2019
Google Drive TVDB Video Renamer
View *README.md

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.

Setup

  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
leoherzog / code.gs
Created Feb 20, 2019
Add All Google Contacts with a Phone Number to a Label
View code.gs
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
leoherzog / callsigns.js
Last active Jan 17, 2019
Amateur (Ham) Radio US Vanity Callsign Rules for Javascript
View callsigns.js
// http://www.arrl.org/vanity-call-signs
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
leoherzog / code.gs
Created Feb 27, 2018
[Google Apps Script] Change Owner of Google Drive Folder and All It's Contents
View code.gs
var allFolders = [];
var allFiles = [];
function changeOwnership() {
var newOwner = "new.owner@gmail.com";
var folderIdToChange = "0B7uECGWKsTGu712INmZSYzReSBE";
// update the global allFiles and allFolders arrays
allFolders.push(DriveApp.getFolderById(folderIdToChange));
@leoherzog
leoherzog / *Custom Printer Settings.md
Last active May 23, 2018
Leo's IIIP Monoprice Maker Select Plus Cura 3.1 Config Files
View *Custom Printer Settings.md

Custom Printer Settings

Printer Settings

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

Build Plate Shape: Rectangular

  • Origin at center
  • Heated bed
@leoherzog
leoherzog / index.gs
Last active Dec 19, 2017
Google Apps Script: Upload a File to Google Drive via HTTP POST
View index.gs
// https://developers.google.com/apps-script/guides/web
//
function doPost(e) {
if (!e.parameter.filename) {
return HtmlService.createHtmlOutput("Don't forget a filename parameter in the URL!");
}
if (!e.postData.contents) {
return HtmlService.createHtmlOutput("No POST data received :(");
}
// create a new folder in Google Drive
@leoherzog
leoherzog / *instructions.md
Created Sep 29, 2017
Transfer Ownership of Google Drive Folder and it's Contents
View *instructions.md

Transfer Ownership of Google Drive Folder and it's Contents

Set-up

  1. Make a new Google Sheet
  2. Go to Tools -> Script editor...
  3. Copy and paste the script from below (code.gs) over the sample function text, and save the project (any name will do)

Running to Transfer Ownership

  1. Run function #1 and wait
  2. Run function #2 and wait