Skip to content

Instantly share code, notes, and snippets.

View robindiddams's full-sized avatar
✉️
Please consider the environment before printing this email

Robin Diddams robindiddams

✉️
Please consider the environment before printing this email
View GitHub Profile
# brew install gum
sdmreq () {
output=$(sdm access catalog)
array=()
if [[ $output =~ ^ID.*Name.*Healthy.*Type.*Authentication.*Access.*Tags ]]
then
while IFS= read -r line
do
local resource_id=$(echo "$line" | awk '{print $1}')
@robindiddams
robindiddams / time-promise.ts
Created March 7, 2023 21:18
Promise wrapper that logs the time
const timePromise = <T>(p: Promise<T>, name: string): Promise<T> => {
const start = Date.now();
return p.then((res) => {
console.log(name, 'took', Date.now() - start);
return res;
});
};

Use Google cloud api to invalidate cdn cache

You want to do this in code: Screen Shot 2022-02-07 at 2 35 19 PM

Do it in TypeScript:

First npm i googleapis (I'm using v68.0.0)

@robindiddams
robindiddams / ecoji2.md
Last active September 11, 2021 19:24
Ecoji ambiguous emoji replacement Suggestion

Ecoji Suggested emoji replacements

Padding

index V1 Emoji (hex) Replacement (hex) (name)
- ☕ (2615) -
40 ⚜ (269c) 🪴 (1fab4) (Potted Plant)
41 🏍 (1f3cd) 🛼 (1f6fc) (Roller Skate)
@robindiddams
robindiddams / validate_github_webhook.js
Created March 8, 2021 19:04
How to validate a github webhook in pure Javascript using crypto.
const crypto = require('crypto')
const webhookSecret = 'my-webhook-secret-that-i-put-in-github';
/**
*
* @param rawBody {Buffer} the raw payload of the request
* @param sig {string} the x-hub-signature-256 header value
* @returns true if the signature matches
*/
const validGithubSignature = (rawBody, sig) => {