Skip to content

Instantly share code, notes, and snippets.

View leoherzog's full-sized avatar

Leo leoherzog

View GitHub Profile
@leoherzog
leoherzog / code.gs
Created August 9, 2021 19:58
Google Shared Drive Viewers Automator
/**
* @OnlyCurrentDoc
* 1. Create a new Google Sheet (https://sheet.new) and remove all but one column
* 2. Add all of the email addresses in Column A that you'd like to have as viewers on the Shared Drive
* 3. Click Tools → Script Editor and copy/paste all of this code into the editor
* 4. Edit the Shared Drive ID on line 10 (https://drive.google.com/drive/folders/{Shared Drive ID})
* 5. Click "▷ Run" in the top toolbar, allow authorization, and you're done!
*/
const sharedDriveId = '0AAt_DfuXH73UUA9dVp';
@leoherzog
leoherzog / code.gs
Last active May 20, 2021 20:41
Export Classic Google Sites Attachments to Google Drive Folder
// Go to script.google.com, click "New Project", copy and paste this code in, and click "▷ Run" in the toolbar
function run() {
let sites = SitesApp.getAllSites('example.com');
console.log('Total number of sites: ' + sites.length);
sites = sites.filter(site => {
try {
@leoherzog
leoherzog / *setup.md
Last active March 18, 2021 14:27
Google Doc Clean HTML Output, powered by Apps Script

Google Doc Clean HTML Output, powered by Apps Script

Add this function to your Apps Script project and feed it an ID to a Google Doc.

If you need this on a lot of Docs, you may want to make a new Apps Script project to use as a library. Simply copy and paste this code to the new project, go to the script that's tied to your Doc, add your new Library (the script ID), and call var html = *NameOfYourLibraryProject*.getContent(DocumentApp.getActiveDocument().getId());

@leoherzog
leoherzog / code.gs
Last active February 23, 2021 14:59
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 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 / temp.js
Last active December 9, 2020 15:34
Wunderground Color Temperature Scale with Chroma.js
//<script src="//cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.3/chroma.min.js"></script>
function getColorFromTemp(tempInF) {
// establish the chroma 'scale' object
var tempScaleColors = ["#111111", "#21006B", "#4C006B", "#6B006B", "#990099", "#B300B3", "#CC00CC", "#E600E6", "#FF02FF", "#D100FF", "#9E01FF", "#6600FF", "#1800FF", "#144AFF", "#0E74FF", "#00A4FF", "#00CBFF", "#00E6FF", "#00FFFF", "#01FFB3", "#7FFF00", "#CEFF00", "#FEFF00", "#FFE601", "#FFCB00", "#FFAE00", "#FF9900", "#FE7F00", "#FF4F00", "#FF0700", "#FF4545", "#FF6968", "#FF8787", "#FF9E9E", "#FFB5B5", "#FFCFCF", "#FFE8E8", "#EEEEEE"];
var tempScale = chroma.scale(tempScaleColors).domain([-60,130]).mode('lab');
// extract color from chroma scale by giving it a temp number
var color = tempScale(tempInF);
return color;
}
@leoherzog
leoherzog / code.gs
Created September 25, 2020 18:57
Google Drive Photocopier - Make lots of copies of a file in Drive
// (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 September 1, 2020 21:19
Windy.com Wunderground Temperature Scale

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 / keybase.md
Last active May 13, 2020 13:55
Keybase Verification

Keybase proof

I hereby claim:

  • I am leoherzog on github.
  • I am leoherzog (https://keybase.io/leoherzog) on keybase.
  • I have a public key whose fingerprint is C4FF C7C8 309B 8E7F 9954 8BBB 17B9 6B0F B3EC DB85

To claim this, I am signing this object:

@leoherzog
leoherzog / *README.md
Last active December 27, 2019 23:45
Google Drive TVDB Video Renamer

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 / *App Flow.md
Last active November 27, 2019 16:25
Pseudocode for Flicki. Package name: productions.agentl.flicki

The app Muzei (https://muzei.co/) has lots of plugins (https://play.google.com/store/search?q=muzei&c=apps). I would like you to create one in Java that uses the Flickr API and Android Awareness APIs. Familiarity in Retrofit, REST APIs, and the Android Awareness API are a must. App itself will have no launcher icon and no UI, and will act as a plugin for Muzei.

When the Art Source is selected, the finished app must:

  • Attempt to get the user's location via the Fused Location API from Google Play Services
    • If the location isn't granted, pop up dialog message saying it's required and ask again (loop until granted or cancelled)
  • Start the initial refresh

When it's time for a refresh, the finished app must:

  • Get current weather condition for user's location via the NWS JSON API v3 (happy to assist with this)
  • Ask Flickr for photos for this location