Skip to content

Instantly share code, notes, and snippets.

View jhpacker's full-sized avatar

Jason Packer jhpacker

  • https://www.quantable.com
  • Columbus, OH
View GitHub Profile
#!/bin/bash
## run this with .
# your IAM user
IAM='xx:mfa/xx' # get from console or `aws sts get-caller-identity`
# uses macosx gnu version of utils like numfmt, grep, etc.
if [[ $(uname -s) = *Darwin* ]]; then
DATE='gdate'
@jhpacker
jhpacker / s3_usage.sh
Last active February 7, 2020 17:44
s3 storage per bucket
#!/bin/bash
# jason@quantable.com 2020-02-07
# display S3 usage by bucket & type from cloudwatch billing info, not inspecting bucket itself
# requires aws-cli & jq
# usage ./s3_usage.sh profile
# profile is optional, region follows from profile. s3 is region-less but cloudwatch isn't
if [ -z $1 ]; then
PROFILE='default'
@jhpacker
jhpacker / redact-pii-from-ga.js
Last active July 30, 2018 14:48
Redact PII from Google Analytics (GTM)
// from https://brianclifton.com/blog/2017/09/07/remove-pii-from-google-analytics/
function() {
return function(model) {
// Add the PII patterns into this array as objects
var piiRegex = [
{
name: 'EMAIL',
regex: /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi,
group: ''
},{
@jhpacker
jhpacker / get_ga_resources.js
Last active June 6, 2018 15:25 — forked from duncanmorris/get_ga_resources.js
Using PhantomJS to monitor Google Analytics - full code
// initialise various variables
var page = require('webpage').create(),
system = require('system'),
address;
// how long should we wait for the page to load before we exit
// in ms
var WAIT_TIME = 5000;
// if the page hasn't loaded after this long, something is probably wrong.