Skip to content

Instantly share code, notes, and snippets.

View schlos's full-sized avatar

Miroslav schlos

View GitHub Profile

Linux System Metrics

CPU

  • system.cpu.idle: % Idle CPU
  • system.cpu.system: % System CPU
  • system.cpu.user: % User CPU

Disk

@schlos
schlos / Time-based.Gmail.Email.Purge.Script.gs
Last active June 18, 2017 11:29 — forked from dgibbs64/GmailAutoTrash.gscript
Gmail/Inbox Email Purge Script
// Gmail/Inbox Email Purge Script
// Using Google Script
// Clears out all emails older than X days
// Labels
function multipleLabels() {
var myLabels = {
'"Updates"': "7d",
'"Forums"': "7d",
'"Promotions"': "7d",
@schlos
schlos / gmail-snooze.js
Created June 18, 2017 11:20 — forked from ViViDboarder/gmail-snooze.js
Gmail Snooze
/*
Gmail Message Snoozing
Quick implementation to allow snoozing of unread messages in Gmail
Usage:
The move unread emails into a snooze label for the desired snooze time. After
the specified time, the message should be moved back into your inbox. This will
only effect unread emails to prevent messages from continuing to bounce back
@schlos
schlos / Gmail-Scheduler.gs
Last active June 18, 2017 11:16 — forked from dwerbam/Code.gs
Gmail Scheduler
function installScript() {
// Makes sure that only 1 scheduler is installed
uninstallScript();
// Trigger every 1 hour.
ScriptApp.newTrigger('gmailScheduler')
.timeBased()
.everyHours(1)
.create();
// ==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() {
@schlos
schlos / .en.md
Created June 18, 2017 11:13 — forked from oshliaer/.en.md
Gmail checker
@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 / 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 / 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 / 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.