Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"Install Oh My ZSH!
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"| # | |
| # 1. Create AWS Lambda function: | |
| # Runtime - Amazon Linux 2023 | |
| # Architecture - arm64 | |
| # 2. Build the Go executable packaged into a zip file | |
| # 3. Upload the zip file | |
| # | |
| all: build package | |
| build: |
| package main | |
| import ( | |
| "context" | |
| "encoding/json" | |
| "errors" | |
| "fmt" | |
| "github.com/aws/aws-lambda-go/lambda" | |
| "log/slog" | |
| "os" |
| require 'aws-sdk-ssm' | |
| require_relative './neko-logger' | |
| L = Neko::Logger.logger | |
| SSMPS_KEY_PATH = '/config/path/' | |
| def config | |
| # Skip if config was loaded within the last hour | |
| if @config_loaded.nil? || (Time.now - @config_loaded > 3600) | |
| L.info('Loading config from SSMPS') |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"| # | |
| # Build and Package RubyGems for AWS Lambda Layer Use | |
| # | |
| all: build package | |
| build: | |
| gem i firebase-ruby -Ni ruby/gems/2.5.0 | |
| gem i darksky-ruby -Ni ruby/gems/2.5.0 | |
| ls -m ruby/gems/2.5.0/gems |
| # Generate the now preferred Ed25519 key | |
| ssh-keygen -t ed25519 | |
| # Search in known_hosts file | |
| ssh-keygen -F "hostname" | |
| # Remove key(s) from known_hosts file | |
| ssh-keygen -R "hostname" |
Firebase REST queries require access_token parameter for full access. This is Google’s OAuth 2.0 for service accounts.
| function getLambdaEventSource(event) { | |
| if (event.Records && event.Records[0].cf) return 'isCloudfront'; | |
| if (event.configRuleId && event.configRuleName && event.configRuleArn) return 'isAwsConfig'; | |
| if (event.Records && (event.Records[0].eventSource === 'aws:codecommit')) return 'isCodeCommit'; | |
| if (event.authorizationToken === "incoming-client-token") return 'isApiGatewayAuthorizer'; | |
| if (event.StackId && event.RequestType && event.ResourceType) return 'isCloudFormation'; |
| # See: https://rvm.io/rvm/install | |
| # Install public key | |
| gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 | |
| # Single-user install | |
| \curl -sSL https://get.rvm.io | bash -s stable --ruby | |
| # Multi-user install; after install, add users to "rvm" group | |
| \curl -sSL https://get.rvm.io | sudo bash -s stable |