Skip to content

Instantly share code, notes, and snippets.

View schlos's full-sized avatar

Miroslav schlos

View GitHub Profile
@schlos
schlos / GMailReminder.gs
Created June 16, 2017 16:01 — forked from kshwetabh/GMailReminder.gs
Reminder script for GMail: A simple Google Apps Script to create a Google Calendar event (reminder) for any mail (with a specific label). You can then setup ("timed") triggers in Apps Script... (public version of the GMailReminder gist)
/**
* Reminder script for GMail: A simple Google Apps Script to create a Google Calendar event (reminder) for any mail (with a
* specific label). You can then setup ("timed") triggers in Apps Script (hourly, etc) to monitor your Inbox.
* How to Use:
* 1. Log into Google Drive account and create a Google Script.
* 2. Copy and paste the below snippet into the gs file.
* 3. Make sure to update the 'reminderLabel', 'calendarName' and 'reminderDuration' as per your preference.
* 4. Test the script to make sure it is working properly.
* 5. Setup a time-driven Project Trigger (hourly, etc) to automatically run this script and create calendar events.
*
@schlos
schlos / filter_long_emails.js
Created June 16, 2017 16:04 — forked from rboyd/filter_long_emails.js
google apps script to archive and autoreply to long emails.
/* paste into http://script.google.com
run periodically (e.g. every 5 minutes) with a timer by selecting 'Resources' > 'current project's triggers...'
*/
function filterLongEmails() {
var num_messages = 1; // will be applied to the last n messages. Google allows up to 500
var word_limit = 50;
var subj = "Shorter emails will get read.";
var body = "Dear friends, I value my time and yours but I appreciate it if you can keep your emails under " + word_limit + " words. Please edit and resend.";
@schlos
schlos / Gmail_to_RTM.js
Created June 16, 2017 16:07 — forked from jesseh/Gmail_to_RTM.js
Create Remember The Milk tasks from Gmail threads by simply adding a label. A Google App Script
/*
This script watches a gmail account for any thread labeled with 'rtm'. When such a thread is found it
sends a task-creation email to Remember the Milk that includes a link back to the original thread.
To follow the link back to the email you have to be logged in to the originating Gmail account (which
is only an issue if you have multiple gmail accounts). Otherwise Google claims the email cannot be
found.
To install it go into Google Drive and create a new "Script" (the link is a bit hidden in the create submenu).
Copy this code into the new project and set a time-based trigger.
@schlos
schlos / batch-delete-gmail-emails.js
Created June 16, 2017 16:15 — forked from gene1wood/batch-delete-gmail-emails.js
A Google Apps Script script to bulk delete large amounts of email in Gmail while avoiding the error #793 which Gmail encounters normally
# This script, when used with Google Apps Scripts will delete 500 emails and can be triggered to run every minute without user interaction enabling you to bulk delete email in Gmail without getting the #793 error from Gmail.
# Configure the search query in the code below to match the type of emails you want to delete
# Browser to https://script.google.com/.
# Start a script and paste in the code below.
# After you past it in, save it and click the little clock looking button. This is for your triggers. You can set up how frequently you want the script to run (I did mine for every minute).
# Source : # https://productforums.google.com/d/msg/gmail/YeQVDuPIQzA/kpZPDDj8TXkJ
function batchDeleteEmail() {
var batchSize = 100 // Process up to 100 threads at once
@schlos
schlos / gmailstats.gs
Created June 18, 2017 11:03 — forked from dalehamel/gmailstats.gs
Basic Gmail statistics
// To load this script, open a Google Sheet (yeah, weird I know), then select "Tools->Script Editor"
// From there, past this content into a script. You can set up triggers to run this script every day at a certain time
// by selecting Resources -> Triggers.
// I recommend you set the trigger to every 5-10 minutes. This will let the batches complete. If the trigger is too infrequent, it wont have time to finish.
// https://developers.google.com/apps-script/reference/gmail/
// For large inboxes (the ones you want to analyze) gmail will rate limit you.
// They recommend adding a sleep to call less, but then your exec time will be too long.
// To solve this, we run in batches. This is the batch size. Decrease this if exec time is too long.
@schlos
schlos / gh-gmail-label-script.js
Created June 18, 2017 11:08 — forked from cobyism/gh-gmail-label-script.js
GitHub Email Notification labeller script for Google Apps/Gmail
var my_teams = ["@github/css", "@github/design"] // Add any teams you want autodetected to this list
var base_label = ["GitHub"]
var my_teams_regex = new RegExp('(' + my_teams.join('|') + ')')
function GitHubThread(thread) {
this._thread = thread
// Determine why we got this message and label the thread accordingly.
//
@schlos
schlos / gmail-snooze.js
Created June 18, 2017 11:11
GMail Snooze Script
var LABEL = 'Snooze';
var MONTHS = 1;
var MARK_UNREAD = true;
var ADD_UNSNOOZED_LABEL = true;
function dailySnooze() {
var today;
var page;
var d = new Date();
var day = d.getDate();
@schlos
schlos / Clean GMail.js
Created June 18, 2017 11:11
Clean GMail
// This script retrieves contents of Gmail Inbox and leaves only
// predefined amount of last messages. Old messages will be
// moved to archive.
function cleanOld(){
var old_threads = GmailApp.getInboxThreads();
var leave = 30;
if (old_threads.length>=leave){
for (var i=leave; i<old_threads.length; i++){
@schlos
schlos / .en.md
Created June 18, 2017 11:13 — forked from oshliaer/.en.md
Gmail checker
// ==UserScript==
// @name gmail-enhancer
// @namespace gmail-enhancer
// @description gmail-enhancer UX experience
// @include https://mail.google.com/mail/*
// @version 1.2
// @grant none
// ==/UserScript==
(function() {