Skip to content

Instantly share code, notes, and snippets.

View leoherzog's full-sized avatar

Leo leoherzog

View GitHub Profile
@leoherzog
leoherzog / code.gs
Last active June 14, 2017 18:48
Google Calendar Event Deleter - Remove all events on your calendar that were created by a certain id
function run() {
findAndNuke("blah@gmail.com");
}
/**
* This simple script gets all of your events on your calendar and deletes any that were created by "id".
* Useful for rogue events created by email addresses that don't exist anymore.
*
* @param {string} id (email address) of the creator of the events you want to get rid of
*/
@leoherzog
leoherzog / *instructions.md
Created September 29, 2017 19:06
Transfer Ownership of Google Drive Folder and it's Contents

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
@leoherzog
leoherzog / *WeatherWallpaper.tsk.xml
Last active December 13, 2017 21:32
Weather Wallpaper Flickr Tasker Task
<TaskerData sr="" dvi="1" tv="4.8u1m">
<Task sr="task19">
<cdate>1458152913165</cdate>
<edate>1458658344165</edate>
<id>19</id>
<nme>Weather Wallpaper</nme>
<pri>100</pri>
<Kid sr="Kid">
<launchID>19</launchID>
<pkg>eqs.wdr.ynk</pkg>
@leoherzog
leoherzog / index.gs
Last active December 19, 2017 18:38
Google Apps Script: Upload a File to Google Drive via HTTP POST
// 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 / code.gs
Created February 27, 2018 14:50
[Google Apps Script] Change Owner of Google Drive Folder and All It's Contents
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 19:43
Leo's IIIP Monoprice Maker Select Plus Cura 3.1 Config Files

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 / callsigns.js
Last active January 17, 2019 21:40
Amateur (Ham) Radio US Vanity Callsign Rules for Javascript
// 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 February 20, 2019 19:25
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
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