Skip to content

Instantly share code, notes, and snippets.

adamjarret / getJSON.js
Last active Jul 9, 2020
Node.js: Fetch and parse JSON content from a URL (no dependencies)
View getJSON.js
const { get } = require('https');
function getJSON(url, options) {
return new Promise((resolve, reject) => {
get(url, options, (res) => {
let body = '';
res.on('data', (data) => {
body += data;
adamjarret /
Last active Apr 11, 2018
Get ssh command for connecting to AWS Cloud9 EC2 Environment (forward port 8080)
WAN=$(curl -s
LAN=$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)
echo "ssh ec2-user@$WAN -L 8080:$LAN:8080"
adamjarret / LogShipToCloudWatch.js
Created Oct 13, 2017
AWS Lambda for shipping logs from S3 to CloudWatch
View LogShipToCloudWatch.js
const aws = require('aws-sdk');
const s3 = new aws.S3({apiVersion: '2006-03-01'});
const cw = new aws.CloudWatchLogs({apiVersion: '2015-01-28'});
const AlreadyExists = 'ResourceAlreadyExistsException';
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
// Thanks
function cascade(tasks, callback, ignoreError)

Keybase proof

I hereby claim:

  • I am adamjarret on github.
  • I am atj ( on keybase.
  • I have a public key ASD05HPxI3ZcvsRS52voRRB4HaIcVOzCw2yKVxRbISlQ2wo

To claim this, I am signing this object: