Skip to content

Instantly share code, notes, and snippets.

View leoherzog's full-sized avatar

Leo leoherzog

View GitHub Profile
@leoherzog
leoherzog / main.py
Last active April 23, 2024 21:01
Bulk Download or Delete Zoom Recordings
#!/usr/bin/python3
#
# call main.py --user <user email> --download --delete
#
import os
import argparse
import json
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime, timedelta
@leoherzog
leoherzog / temp.ino
Created October 27, 2023 16:34
Temperature Color Gradients
#include "map2colour.h"
uint32_t wundergroundColors[] = {
0x00111111, 0x0021006B, 0x004C006B, 0x006B006B, 0x00990099, 0x00B300B3,
0x00CC00CC, 0x00E600E6, 0x00FF02FF, 0x00D100FF, 0x009E01FF, 0x006600FF,
0x001800FF, 0x00144AFF, 0x000E74FF, 0x0000A4FF, 0x0000CBFF, 0x0000E6FF,
0x0000FFFF, 0x0001FFB3, 0x007FFF00, 0x00CEFF00, 0x00FEFF00, 0x00FFE601,
0x00FFCB00, 0x00FFAE00, 0x00FF9900, 0x00FE7F00, 0x00FF4F00, 0x00FF0700,
0x00FF4545, 0x00FF6968, 0x00FF8787, 0x00FF9E9E, 0x00FFB5B5, 0x00FFCFCF,
0x00FFE8E8, 0x00EEEEEE
@leoherzog
leoherzog / code.gs
Created September 19, 2023 18:33
Google Doc Change Notifier
/**
* 1. Go to script.google.com, and when logged in as the user that you want to do the "checking", click "➕ New Project" in the top right
* 2. Copy/Paste all of this code into your new project, and give it a name (e.g. Google Doc Change Notifier)
* 3. Change the `const docs = []` line to include all of the Docs you want to check. For example, `const docs = ["https://docs.google.com/document/blah", "https://docs.google.com/document/foo"];
* 4. Click "▷ Run" in the toolbar and authorize the script to run.
* 5. You're done!
*/
const docs = ["https://docs.google.com/document/d/1Gwt56BiconMLg_u-hdo0asdff27U7DlqLOzHVVgNnoM/edit"];
@leoherzog
leoherzog / voicewatch.py
Last active May 29, 2023 17:42
Python Discord Bot to post to a text channel when people join or leave a voice channel
#!/usr/bin/python3
import discord
import random
intents = discord.Intents.default()
intents.voice_states = True
client = discord.Client(intents=intents)
join_phrases = ['👋 **{0}** joined **{1}**', '🙋 Hi **{0}**! Welcome to **{1}**', '😊 Welcome to **{1}**, **{0}**!', '🤩 EVERYONE SHUT UP! **{0}** is in **{1}** now.']
@leoherzog
leoherzog / code.gs
Last active February 27, 2023 21:58
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 (https://script.google.com/),
// make a new hue remote app id (https://developers.meethue.com/my-apps/),
// copy the app id and secret onto lines 54 and 55 of hue-oauth-stuff.gs,
// publish as a web app,
// go to the web app and authorize via oauth,
// run createBridgeUser() on the hue-oauth-stuff page,
// change the groupname to the Hue group you want to change,
// change the lat and long to your location (to calculate sunrise and sunset times),
@leoherzog
leoherzog / *Set-up.md
Last active August 10, 2022 21:50
A Bash Script to Make RSS Feeds into Kindle Books

Grab a feed and make a Kindle book out of it's latest entry

This script downloads an RSS feed, assembles it's latest entry into a nice HTML file, downloads all of the assets required, generates a Kindle .mobi book with Amazon's official tool, sends me a Pushbullet notification that it worked, and uploads the .mobi book to my Dropbox.

If you wanted, you could then have a tool like this upload it to your Kindle wirelessly.

Set-up:

  • Copy parse.sh and dropbox_uploader.sh to your working directory that you'd like the script to live
  • chmod +x parsh.sh dropbox_uploader.sh
@leoherzog
leoherzog / Code.gs
Last active July 5, 2022 15:05
Gather All Google Drive Files of a Certain Type and Change Owner
const newOwner = 'blah@example.com';
const fileTypesToTransfer = ['application/vnd.google-apps.form']; // https://developers.google.com/drive/api/guides/mime-types
function changeOwnership() {
console.log('Gathering all files in Drive of type ' + fileTypesToTransfer.join(',') + '...');
let fileIterator = DriveApp.searchFiles(fileTypesToTransfer.map(x => 'mimeType = "' + x + '"').join(' or '));
let files = [];
while (fileIterator.hasNext()) {
@leoherzog
leoherzog / *Setup.md
Last active April 27, 2022 14:13
Setting Up Aerial Screensaver on Linux
  • sudo apt install xscreensaver jq aria2 notify-osd
  • Make a directory in $HOME called Aerial
  • Copy aerial-downloader.sh below into $HOME/Aerial
  • Run it once
  • crontab -e
  • 00 10 * * * sh $HOME/Aerial/aerial-downloader.sh to download new stuff (if any) at 10:00 every day
  • nano ~/.xscreensaver and add the code in the file below
  • Open up the XScreensaver app and pick "Apple Aerial"
  • gnome-session-properties and add xscreensaver -nosplash to the list
  • If you want, go into the System Settings and add a keyboard shortcut for Shift + Win + L to launch the command xscreensaver-command -lock
@leoherzog
leoherzog / Code.gs
Created March 18, 2022 17:33
Find emails in your Google Directory for names in a Google Sheet
/*
* This is a script to look through column x for names,
* search your directory for email addresses for that name,
* and print them into column y.
*
* To get started:
* 1. Open an existing Google Sheet or create a new one (https://sheets.new) and give it a name.
* 2. Click Extensions → Apps Script and give that new Apps Script project a name (e.g. "Lookup Email from Name").
* 3. Paste all of this code into that project.
* 4. Specify if it has a header row on line 19 of the code (true or false), as well as the name and email column letters on lines 20 and 21.
@leoherzog
leoherzog / code.gs
Last active February 22, 2022 20:28
Google Drive Folder ID Finder
/**
* This script creates a simple web app where the visitor can select a Google Drive folder with the Google Picker and it will tell you the ID of the folder, since that's now hard to find in the Google Drive web app or Folder URL.
* To get started:
* 1. Go to script.google.com and log in as the user that you want to host this published web app.
* 2. Click "New Project".
* 3. Rename the project at the top from "Untitled project" to something else (ex. "Folder ID Finder")
* 4. Copy/paste this code over the default "myFunction" starter code that's currently there
* 5. Click the ➕ next to "Files" in the sidebar, add an "HTML" file, name it "index" (.html is added by Apps Script), and paste the `index.html` code below over the starter code in that file.
* 6. Click "Deploy ▼" → "New Deployment". In the "Select Type" ⚙️ gear, choose "Web App". Change "Execute as" to "User accessing the web app" and "Who has access" to "Anyone with a Google Account". Click "Deploy".
* You're done! The long "Web app" URL c