Skip to content

Instantly share code, notes, and snippets.

View vgw-rhysc's full-sized avatar

Rhys Campbell vgw-rhysc

View GitHub Profile
@vgw-rhysc
vgw-rhysc / Dockerfile
Last active March 28, 2019 04:37
Test for HTTP security headers - adjust headers and urls appropriately - see https://securityheaders.com
FROM python:3.7.3-alpine3.9
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [ "python", "./http_header_test.py" ]
@vgw-rhysc
vgw-rhysc / index.js
Created October 12, 2018 07:55
AWS Lambda to translate Snowplow CloudFront logs to usable JSON - Using S3 create events as the trigger
console.log('Loading function');
const aws = require('aws-sdk');
const zlib = require('zlib');
const CloudFrontParser = require('cloudfront-log-parser');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
let getS3FileContents = async(bucketName, objectKey) => {
const params = {
@vgw-rhysc
vgw-rhysc / Cf_LogParser.js
Last active December 22, 2017 09:11
Clickstream samples with Snowplow
const CloudFrontParser = require('cloudfront-log-parser');
const fs = require('fs');
const zlib = require('zlib');
var gzippedFilePt = "/Users/rhys/Downloads/E25TC780L4OA1V.2017-12-22-05.e1c5f2ed.gz";
var processAccessEntry = function(access){
var queryString = access['cs-uri-query'];
var decodedQueryString = decodeURI(decodeURI(queryString));
var arr = decodedQueryString.split("&")
@vgw-rhysc
vgw-rhysc / app.js
Created December 19, 2017 11:01
Sample SPA app that authenticates with OKAT - replace "THE CLIENT ID HERE"
const express = require('express');
const OktaJwtVerifier = require('@okta/jwt-verifier');
var cors = require('cors');
var oktaApplicationClientId = "THE CLIENT ID HERE"
const oktaJwtVerifier = new OktaJwtVerifier({
issuer: 'https://vgw.okta.com/oauth2/ausfg73gzLfAb6cKg2p6', //Auth server
assertClaims: {
cid: oktaApplicationClientId,