Skip to content

Instantly share code, notes, and snippets.

@pinkeen
pinkeen / cleanup.gs
Created May 30, 2020 17:26
Clean GMail Google Apps Script
/*************************************************************************************************
* Simple Google Apps script for removing GMail messages
*
* Rationale: If you've got hundreds of thousands of e-mails (automated error reports in my case)
* filling up your account's quota and there's too many of them creating huge threads so
* GMail GUI, IMAP or anything else cannot handle this removal.
*
* Usage: Set up your query and run this script using a trigger every 5/10 minutes - it took days
* for my Inbox to be finally free from the crap.
*************************************************************************************************/
@mmacia
mmacia / in_memory_files.php
Created July 6, 2011 07:16
Generate files in-memory with PHP
<?php
/**
* This snippet shows a PHP neat trick: build a file into memory without use the filesystem.
*/
$fp = fopen('php://memory', 'rw'); // open an in-memory handler
for ($i = 0; $i < 100; ++$i) { // write some data to handler
fwrite($fp, $i."\n");