Skip to content

Instantly share code, notes, and snippets.

View lucagrulla's full-sized avatar

Luca Grulla lucagrulla

View GitHub Profile
@lucagrulla
lucagrulla / cloudwatch_s3.rb
Last active January 23, 2018 15:49
S3 buckets size
require 'aws-sdk-cloudwatch'
require 'aws-sdk-s3'
START_DATE = Time.new(2018,1,21).utc
END_DATE = Time.new(2018,1,22).utc
REGION = "eu-west-1"
CW = Aws::CloudWatch::Client.new(region: REGION)
S3 = Aws::S3::Resource.new(region: REGION)

Keybase proof

I hereby claim:

  • I am lucagrulla on github.
  • I am lucagrulla (https://keybase.io/lucagrulla) on keybase.
  • I have a public key ASCbQRN_-ONzKQ6Gjkom4xyhKgI1vqIsVHtA-SMN2R-BtQo

To claim this, I am signing this object:

@lucagrulla
lucagrulla / gmail-auto-archive
Last active March 29, 2020 11:09
Automatically archive email threads with a given label after a certain number of days - https://script.google.com/home
function auto_archive_mails() {
var filter = "label:inbox and {label:blah label:foo} older_than:3d"
var threads = GmailApp.search(filter);
console.log("found:", threads.length, " threads");
threads.forEach(function(t) {
console.log("archived:", t.getFirstMessageSubject(), t.getLastMessageDate());
t.moveToArchive();
})
console.log("finished.");