Skip to content

Instantly share code, notes, and snippets.

View brianfoody's full-sized avatar
🙃
Play

Brian brianfoody

🙃
Play
View GitHub Profile
@brianfoody
brianfoody / count.sh
Created September 19, 2018 12:40
Count Items in a DynamoDB Table
aws dynamodb scan --table-name <TABLE_NAME> --select "COUNT"
@brianfoody
brianfoody / gm
Created September 20, 2018 06:43
const gm = require('gm').subClass({ imageMagick: true }); // Enable ImageMagick integration.
gm()
.command("convert")
.in(imageIn)
.borderColor("white")
.border(1, 1)
.fill("none")
.fuzz(`${fuzz}%`)
.draw("matte 1,1 floodfill")
# ssh -i ./MY.pem [email protected]
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig
export PATH=/usr/bin:$PATH
# No c compiler error
# export LDFLAGS="-static -L/usr/lib64:/usr/lib"
export LDFLAGS=-L/usr/lib64:/usr/lib
export LD_LIBRARY_PATH=/usr/lib64:/usr/lib:/usr/lib/libharfbuzz.a
export CPPFLAGS=-I/usr/include
sudo yum-config-manager --enable epel
@brianfoody
brianfoody / App Store Icons
Last active February 8, 2020 05:27
Generate App Store icons from icon
sips -Z 40 --out generated/[email protected] icon.png
sips -Z 60 --out generated/[email protected] icon.png
sips -Z 58 --out generated/[email protected] icon.png
sips -Z 87 --out generated/[email protected] icon.png
sips -Z 80 --out generated/[email protected] icon.png
sips -Z 120 --out generated/[email protected] icon.png
@brianfoody
brianfoody / DeadLetterQueueStack.ts
Last active July 24, 2024 02:01
Dead Letter Queue example with CDK
import { Queue } from "@aws-cdk/aws-sqs";
import { App, Duration, Stack, StackProps } from "@aws-cdk/core";
import { Runtime, Code, Function } from "@aws-cdk/aws-lambda";
import { SqsEventSource } from "@aws-cdk/aws-lambda-event-sources";
class DeadLetterQueue extends Stack {
constructor(parent: App, name: string, props?: StackProps) {
super(parent, name, props);
@brianfoody
brianfoody / MultiRegionServerlessCDK.ts
Last active February 29, 2020 11:53
Multi-region serverless application with AWS CDK
import {
RestApi,
CfnAuthorizer,
DomainName,
EndpointType,
CfnBasePathMapping
} from "@aws-cdk/aws-apigateway";
import { Certificate, ValidationMethod } from "@aws-cdk/aws-certificatemanager";
import { Construct } from "@aws-cdk/core";
import {
@brianfoody
brianfoody / greengrass-cdk.ts
Created April 25, 2020 07:35 — forked from t04glovern/greengrass-cdk.ts
Example of Greengrass Core deployment with AWS CDK
import cdk = require('@aws-cdk/core');
import greengrass = require('@aws-cdk/aws-greengrass');
import lambda = require('@aws-cdk/aws-lambda');
import { CfnCustomResource } from '@aws-cdk/aws-cloudformation';
import { PolicyStatement, Role, ServicePrincipal, CompositePrincipal } from '@aws-cdk/aws-iam';
import { group_deployment_reset_code } from '../lib/code/group_deployment_reset';
import { thing_vendor_code } from '../lib/code/thing_vendor';
@brianfoody
brianfoody / Edge Point
Last active May 29, 2020 12:29
Circle Edge Point
const calcEdgePoint = (center: number, radius: number, degree: number): Point => {
const degreeInRadians = degToRadians(degree);
return [
center + Math.cos(degreeInRadians) * radius,
center + Math.sin(degreeInRadians) * radius
];
};
const edgePointCalculatorFor = (center: number, radius: number) => (degree: number): Point => {
const degreeInRadians = degToRadians(degree);
return [
center + Math.cos(degreeInRadians) * radius,
center + Math.sin(degreeInRadians) * radius
];
};
const calculateEdgePoint = edgePointCalculatorFor(60, 50);
const eightyDegreesAlongCircle = calculateEdgePoint(80)
{times(3).map(i => (
<Circle
key={`circle_outline_${i}`}
cx={viewBoxCenter}
cy={viewBoxCenter}
r={(i + 1) * radius * 0.25}
stroke="black"
strokeOpacity="0.2"
strokeWidth="0.5"
fill="transparent"