Skip to content

Instantly share code, notes, and snippets.

Power wheels, power wheels, pow-pow-power wheels!

Ben Francom bfrancom

Power wheels, power wheels, pow-pow-power wheels!
View GitHub Profile
bfrancom /
Last active April 27, 2023 14:08
Get all environment variables with URI's in Kubernetes to find 3rd party services used
#should get all uri's (including url's) for things like s3, postgres, ftp, etc.
kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{.spec.containers[*].env[*].value}{"\n"}{end}' |grep -io "[[:alnum:]]*://[^ ]*" |sort |uniq
bfrancom /
Last active March 21, 2023 20:25
Microsoft Graph search groups by name
#need to add a request header ConsistencyLevel:eventual
bfrancom / Dockerfile
Last active March 7, 2023 15:34
Dockerfile for building java app in GitHub actions and deploying to AWS ECS/Fargate
View Dockerfile
#See for deploying this docker container on ECS Fargate
FROM openjdk:8-jdk-slim as builder
#WORKDIR build
RUN mkdir target
ARG JAR_FILE=./target/*.jar
COPY ${JAR_FILE} target/app.jar
#You probably don't want to do this in production, and should tune memory, gc, etc.
ENTRYPOINT ["java","-jar","/target/app.jar"]
bfrancom / build-jar-deploy-ecs-fargate.yml
Last active March 7, 2023 15:35
GitHub actions build Java jar and deploy to AWS ECS Fargate
View build-jar-deploy-ecs-fargate.yml
#See for Dockerfile used
#Author: Ben Francom
name: Build
#on: workflow_dispatch
- "main"
bfrancom /
Last active March 7, 2023 18:12
Get direct reports of manager from Microsoft Graph API filtered by name and email.
#Get users under a manager using MS graph query. Uses select filter for displayName and email address
#Use this query in$select=displayName,mail
bfrancom /
Last active February 24, 2023 22:15
Quick one liner to get AWS users in an account
aws iam list-users --query 'Users[*].UserName'
bfrancom / pipelinestack.ts
Created February 16, 2023 15:55
CDK Pipeline with GitHub, Artifactory, and Tests
View pipelinestack.ts
import * as cdk from 'aws-cdk-lib';
//import * as codecommit from 'aws-cdk-lib/aws-codecommit';
import { Construct } from 'constructs';
import { BenzPipelineStage } from './pipeline-stage';
import { CodeBuildStep, CodePipeline, CodePipelineSource } from 'aws-cdk-lib/pipelines';
import { aws_codebuild as codebuild } from 'aws-cdk-lib';
export class BenzPipelineStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
bfrancom /
Created May 30, 2022 22:03
AWS CLI Get EC2 Info and Export to CSV
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType'] |jq -r '.[][] | @csv' >>/tmp/ec2.csv
bfrancom /
Last active May 26, 2022 19:46
aws cli iterate through opensearch domains, get info, export to CSV
#export AWS_PAGER="";
# for i in $(aws opensearch list-domain-names |jq -r '.DomainNames[].DomainName')
# do
# aws opensearch describe-domains --domain-name $i --query 'DomainStatusList[*].[EngineVersion,ClusterConfig.InstanceType,ClusterConfig.InstanceCount,EBSOptions.VolumeType,EBSOptions.VolumeSize]'
# done
export AWS_PAGER=""