Skip to content

Instantly share code, notes, and snippets.

View jamesmcintyre's full-sized avatar

James McIntyre jamesmcintyre

View GitHub Profile
@jamesmcintyre
jamesmcintyre / cloudflareworker-verifyjwt.js
Created December 6, 2023 06:27 — forked from bcnzer/cloudflareworker-verifyjwt.js
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/
import tensorflow as tf, sys
image_path = sys.argv[1]
def read_tensor_from_image_file(file_name,
input_height=299,
input_width=299,
input_mean=0,
input_std=255):
input_name = "file_reader"
output_name = "normalized"
@jamesmcintyre
jamesmcintyre / oauth.ts
Created October 21, 2018 15:15 — forked from DennisAlund/oauth.ts
Firebase cloud function for OAuth handshake in medium article https://medium.com/evenbit/151c1c98641d
export const oauth_redirect = functions.https.onRequest(async (request, response) => {
if (request.method !== "GET") {
console.error(`Got unsupported ${request.method} request. Expected GET.`);
return response.send(405, "Only GET requests are accepted");
}
if (!request.query && !request.query.code) {
return response.status(401).send("Missing query attribute 'code'");
}
is_dir() {
DIR=$1
if [ -d $DIR ]; then
echo "YES";
exit;
fi
echo "NO";
}
switch_check_current_exists() {
#check if cache already exists, ask to overwite if so
@jamesmcintyre
jamesmcintyre / nodecheck.sh
Last active November 8, 2022 16:23
bash script to check node/npm version and installed deps against package.json requirements
# more extensive check intended for scenerios such as pulling an existing repo you're unfamiliar with, pulling down changes
# and wanting to ensure your current node_modules/ is up-to-date with any package.json changes, etc.
# you will automatically be prompted to install the two required global npm modules
nodecheck() {
printf "\n\n"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' .
printf "ENVIRONMENT:\n"