Skip to content

Instantly share code, notes, and snippets.

View mwcz's full-sized avatar
🏠
Working from home

Michael Clayton mwcz

🏠
Working from home
View GitHub Profile
const { S3Client, ListObjectsV2Command } = require("@aws-sdk/client-s3");
const client = new S3Client({
region: 'us-east-1',
credentials: {
accessKeyId: process.env['EYEBROWSE_S3_ACCESS_KEY'],
secretAccessKey: process.env['EYEBROWSE_S3_SECRET_ACCESS_KEY'],
},
clientSideMonitoring: true
});
@mwcz
mwcz / memlog.sh
Created November 8, 2016 03:08
A simple script to create graphs of memory usage of Linux processes.
#!/usr/bin/env bash
# usage: memlog.sh PID
# requires gnuplot and matplotlib (dnf install python2-matplotlib gnuplot)
PID=$1
LOG=./$PID.log
PNG=./$PID.log.png
echo recording memory usage for PID $PID
@mwcz
mwcz / next-biggest.js
Created March 16, 2020 18:46
My solution to codewars "Next bigger number with the same digits" kata
// write array `a` onto array `b` starting at position `p`
function overlay(a, b, p) {
for (let [i, n] of a.entries()) {
b[p+i] = n;
}
return b;
}
// in an array, swap items at indexes i1 and i2
function swap(arr, i1, i2) {