Skip to main content

7 posts tagged with "snippet"

View All Tags

Β· One min read
tip

Tired of manually deleting emails? run this and it will automatically delete emails from people you specify from.

Raw Source code:​

https://github.com/mel3kings/startup-snippets/tree/main/blog/googlemailmanager

Prerequisites​

  • npm run install
  • Connect your Gmail with GCP and create your own credentials.json
    • (Should still be valid) credentials.json generated from GCP. (download from GCP API & Services Credentials)
  • Configure deleteEmails.js to add the emails you want to delete from.

How to start​

npm run start

Refresh token:​

  • note: if you change scope you need to delete token.json to regenerate a new one. also reset secret in GCP.
  • note: has some issues if there is an active token elsewhere.

GCP console:​

https://console.cloud.google.com/apis/dashboard?project=

Β· One min read
tip

Curious what it takes to build a serverless API?

Raw Source code:​

https://github.com/mel3kings/startup-snippets/tree/main/blog/lambda

Serverless notes​

  • API gateway needs lambda to have this format in the response to not throw malformed exception:
    {
'statusCode': 200,
'headers': {
},
'body': json.dumps(response_list),
'isBase64Encoded': 'false'
}

Lambda​

  • needs to deploy before testing
  • throttle request set to 1 for singleton

Api gateway​

stages - relative path, needs to deploy first before it goes live

  • throttle request set to 1 for singleton