Skip to content

Instantly share code, notes, and snippets.

View instantiator's full-sized avatar
🐠

Lewis Westbury instantiator

🐠
View GitHub Profile
@instantiator
instantiator / responsive-embed-google-slides.html
Created November 4, 2023 15:59
Responsive embed for a published Google Slides presentation.
<!-- Responsive embed for a published Google Slides presentation, scales with width and preserves proportions. -->
<!-- Standard google slide dimensions are: 960 x 569. Height is roughly 60% of the width. -->
<div style="position: relative; width: 100%; height: 0; padding-bottom: 60%;">
<iframe frameborder="0"
style="width: 100%; height: 100%; position: absolute; left: 0"
allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"
src="https://docs.google.com/presentation/d/e/2PACX-1vQ6WWyyAQK2A0zYRuIGV08vqbZNXCCNvZ7h2FKTWlEbGmWwpb4VgB6j33RiXuWx9NCOr5xJVq7FmFCb/embed?start=false&loop=false&delayms=3000">
</iframe>
</div>
@instantiator
instantiator / cloud-formation-vpc-with-internet.md
Last active April 26, 2024 15:50
AWS CloudFormation/SAM templates for an app that places lambdas inside a VPC, and restores their internet access

Sometimes you need to move your application lambdas inside VPC subnets (eg. if you need them to be able to access an RDS cluster, or another service that doesn't mesh perfectly with serverless). Doing so removes them from the default VPC, and with that they lose internet access.

The templates included here show how you can deploy lambdas inside a VPC, and create a route for them back to the internet.

You can still use API Gateway and trigger your lambdas with events, but now they'll be able to reach the internet, too.

template.yaml creates the VPC, which is then used by all the other resources.

@instantiator
instantiator / build-fap.yml
Last active July 30, 2023 08:50
GitHub Action to build FlipperZero app with ufbt
# place in .github/workflows
name: "build with ufbt"
on:
push:
branches:
- main
pull_request:
branches:
- '**'
jobs:
@instantiator
instantiator / duplicate-dynamodb-table.sh
Last active July 14, 2023 15:44
Bash script to copy one AWS DynamoDB table to another
#!/bin/bash
# exit on error
set -e
set -o pipefail
usage() {
cat << EOF
duplicate-table.sh <first-table-name> <second-table-name>
EOF
@instantiator
instantiator / PathProxy.js
Last active July 14, 2023 15:28
An experimental javascript Proxy object that reports the path that was requested (some limitations)
/** An experimental Proxy that reports the path that was requested */
class PathProxy {
constructor(id) {
let proxy = new Proxy({ identity: id }, {
get: (target, name) => {
if (name.toString() === 'identity') {
return target.identity;
} else {
if (!(name in target)) {
target[name] = new PathProxy(`${target.identity}.${name.toString()}`);
@instantiator
instantiator / png-to-svg.sh
Created July 22, 2022 15:17
Bash script to trace png to svg, using imagemagick and potrace
#!/bin/bash
function print_params() {
echo "Usage: png-to-svg.sh <path-to-png>"
echo
}
# OS X - install pre-requisites
if [ ! -x "$(command -v magick)" ]; then
brew install imagemagick
@instantiator
instantiator / summarise-entity-ids.sh
Created January 5, 2021 17:04
summarise the entity ids found in yaml configuration files
#!/bin/bash
# provide the path to your configuration yaml files as the only parameter
DIR=$1
echo \"file\",\"simple id\",\"LOAs\",\"entity id\",\"MSA entity id\"
for FILE in "$DIR"/*.yml; do
FILENAME=$(basename $FILE)
SIMPLE_ID=$(yq eval '.simpleId' $FILE)
LOAs=$(yq eval '.levelsOfAssurance' $FILE)
@instantiator
instantiator / reset-all-to-main.bash
Last active July 14, 2023 15:27
A tiny bash script to reset all your github repos to the main branch. Complements multi-git-status nicely.
#!/bin/bash
for d in */ ; do
echo "Checking: $d"
pushd $d
if git rev-parse --git-dir > /dev/null 2>&1; then
git checkout main
git pull
else
echo "... not a git repository."
package com.flt.example.eventproviders;
import com.flt.aislethree.sharedservicelib.logging.Log;
import java.lang.ref.WeakReference;
import java.util.EventListener;
import java.util.LinkedList;
import java.util.List;
/**
package com.flt.bothie2.utility;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.util.Log;
import android.util.Pair;
import com.drew.imaging.ImageMetadataReader;
import com.drew.metadata.Directory;