Skip to content

Instantly share code, notes, and snippets.

View bfrancom's full-sized avatar
💥
Power wheels, power wheels, pow-pow-power wheels!

Ben Francom bfrancom

💥
Power wheels, power wheels, pow-pow-power wheels!
View GitHub Profile
@bfrancom
bfrancom / web.conf
Last active January 3, 2024 20:35
cloud-init example
#cloud-config
#
## Install additional packages on first boot
##
## Default: none
##
## if packages are specified, this apt_update will be set to true
##
## packages may be supplied as a single package name or as a list
## with the format [<package>, <version>] wherein the specifc
@bfrancom
bfrancom / matrix.yml
Created July 25, 2023 00:54
How to reference node version more easily
jobs:
example_matrix:
strategy:
matrix:
version: [18]
steps:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
@bfrancom
bfrancom / replace-img-url.sh
Created July 14, 2023 14:20
replace a URL for an image
#!/bin/bash
input="/tmp/realImages.txt"
while IFS= read -r line
do
bob=$(basename $line)
find . -type f -exec sed -i '' -e "s,$line,/images/old/$bob,g" {} \;
done < "$input"
#while read line
#find . -type f -exec sed -e "s/$line/2010/g" {} \;;done < /tmp/realImages.txt
@bfrancom
bfrancom / get-k8s-vars-urls.sh
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
bfrancom / get-ms-graph-groups.sh
Last active March 21, 2023 20:25
Microsoft Graph search groups by name
https://graph.microsoft.com/v1.0/groups?$search="displayName:YourMom"&$select=id,displayName
#need to add a request header ConsistencyLevel:eventual
@bfrancom
bfrancom / get-direct-reports.sh
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 https://developer.microsoft.com/en-us/graph/graph-explorer
https://graph.microsoft.com/v1.0/me/directReports?$select=displayName,mail
@bfrancom
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
#See https://gist.github.com/bfrancom/d2ca0f7c767092a924c99545298b557d for Dockerfile used
#Author: Ben Francom
name: Build
#on: workflow_dispatch
on:
push:
branches:
- "main"
@bfrancom
bfrancom / Dockerfile
Last active March 7, 2023 15:34
Dockerfile for building java app in GitHub actions and deploying to AWS ECS/Fargate
#See https://gist.github.com/bfrancom/6ebebbf899912cd3c76c7f2978be0961 for deploying this docker container on ECS Fargate
FROM openjdk:8-jdk-slim as builder
#WORKDIR build
EXPOSE 8080
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
bfrancom / get-aws-iam-users.sh
Last active February 24, 2023 22:15
Quick one liner to get AWS users in an account
aws iam list-users --query 'Users[*].UserName'