This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from "express"; | |
import cors from "cors"; | |
import apiRoutes from "./api"; | |
import {errorResponder} from "./middleware/errorResponder"; | |
export const app = express(); | |
app.use(cors({origin: '*'})); | |
app.use(express.json()); | |
app.use(express.urlencoded({extended: true})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# settings we’re about to change | |
osascript -e 'tell application "System Preferences" to quit' | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished | |
while true; do | |
sudo -n true | |
sleep 60 | |
kill -0 "$$" || exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Update and upgrade Homebrew | |
echo "Updating Homebrew..." | |
brew update | |
brew upgrade | |
# Install nvm (Node Version Manager) | |
echo "Installing nvm..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import sys | |
from article_agent.config import my_api_key, my_cse_id | |
from googleapiclient.discovery import build | |
def get_search_results(search_term: str, num_search_results: int = 10) -> json: | |
"""Perform a Google search using Custom Search API""" | |
# Build request |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {App, AutoBranchCreation} from '@aws-cdk/aws-amplify-alpha'; | |
import {CfnOutput, SecretValue, Stack, StackProps} from 'aws-cdk-lib'; | |
import {BuildSpec} from 'aws-cdk-lib/aws-codebuild'; | |
import {Construct} from 'constructs'; | |
import {ManagedPolicy, Role, ServicePrincipal} from 'aws-cdk-lib/aws-iam'; | |
import {GitHubSourceCodeProvider} from '@aws-cdk/aws-amplify-alpha/lib/source-code-providers'; | |
import {environmentVariables} from './environmentVariables'; | |
import {CfnApp, CfnBranch} from "aws-cdk-lib/aws-amplify"; | |
import {configuration} from "./config"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serverlessExpress from '@vendia/serverless-express'; | |
import {app} from './app'; | |
let serverlessExpressInstance: any; | |
async function setup (event: any, context: any) { | |
serverlessExpressInstance = serverlessExpress({ app }) | |
return serverlessExpressInstance(event, context) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Stage, StageProps} from "aws-cdk-lib"; | |
import {Construct} from "constructs"; | |
import {DeploymentStack} from "./stack"; | |
interface BackendServiceStageProps extends StageProps { | |
envVars?: Record<string, string>, | |
} | |
export class BackendServiceStage extends Stage { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Stack, StackProps} from "aws-cdk-lib"; | |
import {Construct} from "constructs"; | |
import {ApprovedNodeLambda} from "./constructs/approvedNodeLambdaConstruct"; | |
import {Cors, LambdaIntegration, RestApi} from "aws-cdk-lib/aws-apigateway"; | |
export interface DeploymentStackProps extends StackProps { | |
envVars?: Record<string, string>, | |
} | |
export class DeploymentStack extends Stack { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {DockerImage, Duration} from 'aws-cdk-lib'; | |
import {Alarm, Metric} from 'aws-cdk-lib/aws-cloudwatch'; | |
import {LambdaDeploymentConfig, LambdaDeploymentGroup} from 'aws-cdk-lib/aws-codedeploy'; | |
import {Alias, AssetCode, Function, IFunction, Runtime} from 'aws-cdk-lib/aws-lambda'; | |
import {Construct} from 'constructs'; | |
export interface ApprovedLambdaProps { | |
readonly alarmThreshold?: number; | |
readonly alarmEvaluationPeriod?: number; | |
readonly codeDir: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {BackendServiceStage} from "./stage"; | |
import {ComputeType} from "aws-cdk-lib/aws-codebuild"; | |
import {CodeBuildStep, CodePipeline, CodePipelineSource, ManualApprovalStep} from "aws-cdk-lib/pipelines"; | |
import {PolicyStatement} from "aws-cdk-lib/aws-iam"; | |
import {Stack, StackProps} from "aws-cdk-lib"; | |
import {Construct} from "constructs"; | |
interface PipelineStackProps extends StackProps { | |
repoName: string, | |
branch: string, |
NewerOlder