Skip to content

Instantly share code, notes, and snippets.

@kylemclaren
kylemclaren / run.sh
Created October 18, 2023 10:42
whisperX web API on Fly GPUs
#! /bin/bash
export APP_NAME=yourAppName
fly apps create $APP_NAME
fly vol create -s 50 --vm-gpu-kind a100-pcie-40gb -r ord data -y -a $APP_NAME
# Uncomment for access outside Fly private network
# fly ips allocate-v4 --shared -a $APP_NAME
@kylemclaren
kylemclaren / user-data.sh
Created January 21, 2022 09:32 — forked from codeinthehole/user-data.sh
Get the value of an EC2 instance's tag
#!/usr/bin/env bash
#
# Get the value of a tag for a running EC2 instance.
#
# This can be useful within bootstrapping scripts ("user-data").
#
# Note the EC3 instance needs to have an IAM role that lets it read tags. The policy
# JSON for this looks like:
#
# {
@kylemclaren
kylemclaren / har_instructions.md
Created January 19, 2022 16:17 — forked from legrego/har_instructions.md
Kibana HAR Instructions

A HAR archive of the network timings from a compatible browser is extremely useful in pinpointing which issues with Kibana talking to Elasticsearch.

Note on information gathered in a HAR archive

Please note that HAR archives contain sensitive information:

  • content of the pages you downloaded while recording
  • your cookies, which will allow anyone with the HAR file to impersonate your account
  • all the information that you submitted to your browser while recording (i.e., search values, authentication details).
@kylemclaren
kylemclaren / terminate_all_ec2.sh
Created November 19, 2020 22:55 — forked from rjurney/terminate_all_ec2.sh
Bash script to disable termination protection and then terminate all instances in all regions :)
for region in `aws ec2 describe-regions | jq -r .Regions[].RegionName`
do
echo "Terminating region $region..."
aws ec2 describe-instances --region $region | \
jq -r .Reservations[].Instances[].InstanceId | \
xargs -L 1 -I {} aws ec2 modify-instance-attribute \
--region $region \
--no-disable-api-termination \
--instance-id {}
aws ec2 describe-instances --region $region | \
🗣 Commented on #1 in kylemclaren/hello-github-actions
❗️ Opened issue #1 in kylemclaren/hello-github-actions
@kylemclaren
kylemclaren / twilio-validation.js
Created April 21, 2020 08:35
Twilio CF Worker request validation
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
});
/* WARNING:
Anything starting with REPLACEABLE_SECRET_VDB12_ shouldn't be renamed,
because they are used in deployment transformations.
Do not remove the comment below,
it is required to timestamp workers on upload.
Sent from npm.
@kylemclaren
kylemclaren / mongodb-find-duplicate-field-values.js
Created March 31, 2020 16:27
mongodb find duplicate field values
m = function () {
emit(this.my_field, 1);
}
r = function (k, vals) {
return Array.sum(vals);
}
res = db.MyCollection.mapReduce(m,r, { out : "my_output" });
db[res.result].find({value: {$gt: 1}});
@kylemclaren
kylemclaren / index.html
Created March 31, 2020 13:15
SACoronavirus.co.za banner
<div class="coronaBanner">
<div class="coronaBanner__content">
<a class="coronaBanner__websiteLink" href="https://sacoronavirus.co.za/" rel="noopener nofollow" title="SAcoronavirus.co.za">
<img class="coronaBanner__websiteLinkImg" src=" data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtgAAAB5CAMAAAA00qZVAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAwBQTFRF////9rutDw4Mq8GzAAAACkqZAYVV6VIQBIVWAGQy0d7Xapd8+tvT8I1wBIZY9vb1//j1AWAqUU9Pd3V37GIx+fr6CgcIAFMa/OTfAEsPVVNUoVoIWlhZTEpKxYsQ9KWQAINT+Mi74MNq7nJJAE8U2rdS/e3pAEUIenh5604PJnJH/v79zrBvAFki+tLGEg8P74FeCUiX/fv6XVxd6fDs9LKfcnJz8vTz1ujh4eHhD4td9/j48pmBucy/3ujisrGyqKiofMGpQoFcOTc4MJx04sV/np6e5MltKCYmZbiaunQAamhpxsXGvnsA/v//vby80dHRh4aHVo9tP6R9ja6YREJC2NjYe6SMMS4u3r9oMIJX69it+/XoyqpkY2Fi4fLtAX9d8+F7582RZwkD/bsY1Lug3r5fAmg25OfpmMCrzqhYEWw68O/uyuTcVQAA/fnxjsq0Hx0dzMzLkpGS9nMHn9PBeq6TaqaHxJxM2rZq4dG5ADwAnbinnVME6urr/8kU8OG+xdbL6dFyqsu5AC8Ax5Ec+JEUzLKQyJYt6d7SxIYGJnxQ+/HZW7CRJJZrO4lh9Ozgf31+jjkD++yFdRwKsWIBtHo7AAEMxqFXpm06udjK7tabyqF24MaS5NbG8+jSlEossH9Jr

Keybase proof

I hereby claim:

  • I am kylemclaren on github.
  • I am kylemclaren (https://keybase.io/kylemclaren) on keybase.
  • I have a public key ASBJ41IOHUZ6DuPQq0tqmUwo2JSiDSZZiPLn-SgO8R1R9Qo

To claim this, I am signing this object:

@kylemclaren
kylemclaren / collSize.js
Created November 20, 2016 07:11
MongoDB Collections sizes pretty printed 🌟
use mydb;
// Container class
function CollStats(name, storageSizeGB, indexSizeGB, totalSizeGB) {
this.name = name;
this.storageSizeGB = storageSizeGB.toFixed(0);
this.indexSizeGB = indexSizeGB.toFixed(0);
this.totalSizeGB = totalSizeGB.toFixed(0);
}