Cleanup Gmail emails by filter

This is example how to remove Github Notifications of failed jobs after 7 days:

function cleanupByFilter() {
  deleteEmails('from:[email protected] older_than:7d subject: "Run failed"')
  // For more filters add more `deleteEmails` function executions here 
}

function deleteEmails(filter) {
  var threads = GmailApp.search(filter);
  Logger.log("Deleting " + threads.length + " messsages from filter: " + filter)
   for (var i = 0; i < threads.length; i++) {
      var messages = threads[i].getMessages();
      for (var j = 0; j < messages.length; j++) {
         var message = messages[j];
         message.markRead()
         message.moveToTrash()
      }
   }
}

To setup this see my post here.

Kind - mount resolv.conf to skip systemd-resolved

By default Kind uses system /etc/resolv.conf. This points to systemd-resolved service and some queries might fail. You can mount your network DNS configuration.

Save below config in kind-cluster.yaml:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraMounts:
  - hostPath: /run/systemd/resolve/resolv.conf
    containerPath: /etc/resolv.conf

and run the kind:

$ kind create cluster --config kind-cluster.yaml

Control-plane node should use your network DNS now.

Merging multipe Kubernetes configs
KUBECONFIG=$(ls ~/.kube/*.config | tr "\n" ":") kubectl config view --merge --flatten > ~/.kube/config