Skip to content

Instantly share code, notes, and snippets.

View schlos's full-sized avatar

Miroslav schlos

View GitHub Profile
@schlos
schlos / InsertDate.gs
Last active August 29, 2015 14:26 — forked from thomxc/InsertDate.gs
Google Docs Script Macro: Insert Date
/**
* The onOpen function runs automatically when the Google Docs document is
* opened. Use it to add custom menus to Google Docs that allow the user to run
* custom scripts. For more information, please consult the following two
* resources.
*
* Extending Google Docs developer guide:
* https://developers.google.com/apps-script/guides/docs
*
* Document service reference documentation:
@schlos
schlos / import_json_appsscript.js
Last active August 26, 2018 18:23 — forked from chrislkeller/import_json_appsscript.js
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save. // Check out: https://github.com/bradjasper/ImportJSON for the latest version.
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@schlos
schlos / MailinatorAliases
Created October 20, 2015 07:40 — forked from nocturnalgeek/MailinatorAliases
A list of alternate domains that point to @mailinator.com
@binkmail.com
@bobmail.info
@chammy.info
@devnullmail.com
@letthemeatspam.com
@mailinater.com
@mailinator.net
@mailinator2.com
@notmailinator.com
@reallymymail.com
@schlos
schlos / cf-ddns.sh
Created January 2, 2016 13:33 — forked from larrybolt/cf-ddns.sh
Automatically update your CloudFlare DNS record to the IP, Dynamic DNS for Cloudflare
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
# Automatically update your CloudFlare DNS record to the IP, Dynamic DNS
# Can retrieve cloudflare Domain id and list zone's, because, lazy
# Place at:
# /usr/local/bin/cf-ddns.sh
@schlos
schlos / cloudflare.php
Created January 3, 2016 13:29 — forked from gentlecat/cloudflare.php
CloudFlare DNS records updater
<?php
/**
* Settings
*/
define('API_KEY', $_GET['apikey']); // CloudFlare API key
define('USERNAME', '[email protected]'); // Email address used to login into CloudFlare
define('IP', getCurrentIP()); // Current IP address
echo 'Setting IP address to "' . IP . '"...<br />';
function gmailAutoarchive() {
var delayDays = 2; // will only impact emails more than 48h old
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-delayDays); // what was the date at that time?
// Get all the threads labelled 'autoarchive'
var label = GmailApp.getUserLabelByName("autoarchive");
var threads = label.getThreads(0, 400);
@schlos
schlos / DelayGmail
Created June 16, 2017 14:47 — forked from donalod/DelayGmail
GoogleAppScript_DelayedEmail
function moveDelayedMessages() {
receiveEmails("Delayed Messages");
Utilities.sleep(60000);
reArchive();
}
// receiveEmails() will take all threads in labelname (Default: 'Delayed messages')
// and place them into the mailbox. The intent is for a delayed retrieval of
// messages when combined with a script timer.
function receiveEmails(labelName) {
@schlos
schlos / gmailDelayed.js
Created June 16, 2017 14:49 — forked from pawurb/gmailDelayed.js
Fighting email checking addiction ...
//TODO
//https://developers.google.com/apps-script/managing_triggers_programmatically
function moveDelayedMessages() {
receiveEmails("Delayed Messages");
}
// receiveEmails() will take all threads in labelname (Default: 'Delayed messages')
// and place them into the mailbox. The intent is for a delayed retrieval of
@schlos
schlos / gist:d5fbe61440f6973dc400a4e70a1843de
Created June 16, 2017 15:44 — forked from jceresearch/gist:5755030
Google Apps Script to create a digest from a set of messages in Gmail. It does a bit more than that, filters by time, strips the html, trims legalese (or whatever) and tags messages so they are not processed again. Ideal to schedule it in gmail.
function GenerateDigest() {
//Function that goes through a search query based on time and optional label in gmail, strips html, collates into a single email, sends it to a desired address and then labels the emails as processed.
// Where the digest email is going
var to_emailAddress = "[email protected]";
//We calculate the 24 hour range, I plan to run this every day at 9:00 to get last 24 hours of emails
var month = new Date().getMonth();
@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.
*