Skip to content

Instantly share code, notes, and snippets.

@JeremyPlease
JeremyPlease / readact-json-file.js
Last active April 9, 2019 22:20
Redact phone and email from large json file
const fs = require('fs')
const emailRegex = /@[A-z0-9\.-]{3,50}/g
const phoneRegex = /\+[\d\s-]{4}/g
const liveRegex = /live/g
const file = '/path/to/big/json/file.json'
const outputFile = '/path/to/output/redacted.json'
const inputStream = fs.createReadStream(file, {encoding: 'utf8'})
const outputStream = fs.createWriteStream(outputFile, {encoding: 'utf8'})
// load the AWS SDK
const AWS = require('aws-sdk')
// load CloudFront key pair from environment variables
// Important: when storing your CloudFront private key as an environment variable string,
// you'll need to replace all line breaks with \n, like this:
// CF_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIIE...1Ar\nwLW...2eL\nFOu...k2E\n-----END RSA PRIVATE KEY-----"
const cloudfrontAccessKeyId = process.env.CF_ACCESS_KEY_ID
const cloudFrontPrivateKey = process.env.CF_PRIVATE_KEY
const signer = new AWS.CloudFront.Signer(cloudfrontAccessKeyId, cloudFrontPrivateKey)
@JeremyPlease
JeremyPlease / delete_all_mixpanel_profiles.sh
Created June 22, 2017 20:46
Delete All Mixpanel Profiles
./node_modules/.bin/engage -p '$distinct_id' -k MIXPANEL_KEY -s MIXPANEL_SECRET | jq -c -M '[.[] | {"$distinct_id","$delete":"","$ignore_alias":true}]' >> todelete.json;
cat todelete.json | ./node_modules/.bin/engagepost -k MIXPANEL_KEY -s MIXPANEL_SECRET -t MIXPANEL_TOKEN
@JeremyPlease
JeremyPlease / README.md
Created January 20, 2017 15:14
Remove Custom Attributes from Intercom.io

This script fetches all users from Intercom and sets the name and address custom attributes to null.

  1. run npm i intercom-client
  2. INTERCOM_ID=id INTERCOM_API_KEY=apikey node intercom.js
@JeremyPlease
JeremyPlease / README.md
Created January 20, 2017 15:10
Remove People Properties from Mixpanel

This script queries all users in Mixpanel and $unsets people properties.

  1. run npm i mixpanel mixpanel-data-export-node
  2. MIXPANEL_API_KEY=key MIXPANEL_API_SECRET=secret MIXPANEL_HASH=hash node mixpanel.js
/**
* This patch works around iOS9 UIWebView regression that causes infinite digest errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a dependency on the "ngIOS9Patch" module
* to your main app module.
*
* For example:
*