Skip to content

Instantly share code, notes, and snippets.

View dsandor's full-sized avatar

David Sandor dsandor

View GitHub Profile
@dsandor
dsandor / remove_mcafee.md
Last active April 15, 2020 13:00 — forked from pjobson/remove_mcafee.md
OSX McAfee Removal

Removal of McAfee from OSX

Note: This was written in 2015, it may be out of date now.

There are a lot of commands here which I use sudo if you don't know what you're doing with sudo, especially where I rm you can severely screw up your system.

There are many reasons which you would want to remove a piece of software such as McAfee, such as not wanting it to hammer your CPU during work hours which seems like primetime for a virus scan.

I intend this to be a living document, I have included suggestions from peoples' replies.

exports.authorizerHandler = async (event, context, callback) => {
if (event.headers['Authorization'] && event.headers['Authorization'] !== 'fail') {
callback(null, generatePolicy('user', 'Allow', event.methodArn));
} else {
callback(null, generatePolicy('user', 'Deny', event.methodArn));
}
};
RequestAuthorizerFunction:
Type: AWS::Serverless::Function
Properties:
Policies:
- AWSLambdaVPCAccessExecutionRole
CodeUri: ./
Handler: index.authorizerHandler
Runtime: nodejs12.x
HelloWorldApi:
Type: AWS::Serverless::Api
Properties:
Name: hello-world-api
StageName: v1
MethodSettings:
- LoggingLevel: INFO
ResourcePath: '/*' # allows logging on any resource
HttpMethod: '*' # allows logging on all methods
Cors:
@dsandor
dsandor / template.yaml
Last active February 26, 2020 14:52
Working API Gateway Lambda Request Authorizer
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
hello-world-api
API example of using a request authorizer with API Gateway.
Globals:
Function:
Timeout: 120
{
"Records": [
{
"eventVersion": "2.1",
"eventSource": "aws:s3",
"awsRegion": "us-east-1",
"eventTime": "2020-01-03T15:11:20.855Z",
"eventName": "ObjectCreated:Put",
"userIdentity": {
"principalId": "AWS:AAAAAAAAAAAAAAAAAAAAA"
module.exports.handler = (event) => {
console.log('event:\n', JSON.stringify(event));
};
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
MemorySize: 128
Timeout: 15
Resources:
# S3 Bucket
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
MemorySize: 128
Timeout: 15
Resources:
# Permissions
@dsandor
dsandor / template.yaml
Created January 2, 2020 20:58
SAM Template to connect a Lambda up to an S3 file event.
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Globals:
Function:
MemorySize: 128
Timeout: 15
Resources:
# Roles