diff --git a/public/opengraph-image.jpg b/public/opengraph-image.jpg deleted file mode 100644 index 5c8de96..0000000 Binary files a/public/opengraph-image.jpg and /dev/null differ diff --git a/public/opengraph-image.png b/public/opengraph-image.png new file mode 100644 index 0000000..61eaa3f Binary files /dev/null and b/public/opengraph-image.png differ diff --git a/src/components/seo/SEOTags.astro b/src/components/seo/SEOTags.astro index 70fadb2..b925b64 100644 --- a/src/components/seo/SEOTags.astro +++ b/src/components/seo/SEOTags.astro @@ -7,16 +7,16 @@ type Props = HeadTags; const { title, description, noindex, og } = Astro.props; -const DEFAULT_TITLE_PAGE = "Astro - Portfolio template"; +const DEFAULT_TITLE_PAGE = "Gabe Farrell - mnrva.dev"; const DEFAULT_DESCRIPTION_PAGE = - "A minimal portfolio template built with Astro and Tailwindcss."; + "Gabe Farrell's portfolio and blog website. https://mnrva.dev"; const DEFAULT_URL_SITE = SITE_URL; const openGraph = { title: title || og?.title || DEFAULT_TITLE_PAGE, type: og?.type || "website", - image: og?.image || "/opengraph-image.jpg", - alt: og?.alt || "astro portfolio template image", + image: og?.image || "/opengraph-image.png", + alt: og?.alt || "mnrva.dev portfolio and blog", url: DEFAULT_URL_SITE, description: og?.description || DEFAULT_DESCRIPTION_PAGE, }; @@ -38,9 +38,6 @@ const openGraph = { alt: openGraph.alt, }, }} - twitter={{ - creator: "@itsstormzz_", - }} extend={{ link: [ { rel: "icon", href: "/favicon.svg" }, diff --git a/src/content/posts/01-the-power-of-react-hooks copy.md b/src/content/posts/01-the-power-of-react-hooks copy.md index cc009c7..b7e86b0 100644 --- a/src/content/posts/01-the-power-of-react-hooks copy.md +++ b/src/content/posts/01-the-power-of-react-hooks copy.md @@ -1,54 +1,210 @@ --- -title: "The Power Of React Hooks" -publishedAt: 2023-05-24 -description: "Lorem ipsum dolor sit amet consectetur et ultrices blandit neque ege" -slug: "the-power-of-react-hooks" +title: "Creating Serverless Applications with AWS Lambda and Go" +publishedAt: 2023-11-23 +description: "Learn how to deploy your first AWS Lambda serverless function using Go with this step-by-step guide." +slug: "creating-serverless-lambda-go" isPublish: true --- -## Vocesque meum remis est neque Neptunus monte +Creating Serverless Applications with AWS Lambda and Go +--- +In recent years, serverless computing has become a popular choice for building scalable, flexible, and cost-effective applications. Using serverless solutions, you can focus on writing and deploying code, without having to worry about managing infrastructure. AWS Lambda, Amazon's serverless computing platform, provides a simple and efficient way to run code in response to events, without having to provision or manage servers. In this blog post, I'll take a look at how to build serverless applications using AWS Lambda and the Go programming language. I'll cover the basics of serverless computing, setting up an AWS Lambda function, and writing Go code to handle events and respond to requests. By the end of this post, you'll have a good understanding of how to build and deploy serverless applications using AWS Lambda and Go. Let's get started. + +## What is Serverless? + +Serverless computing is a paradigm shift in the way applications are built and deployed. Instead of having to manage servers and infrastructure, you can focus on writing and deploying code in small, independent functions. With serverless, you only pay for the compute time that your code consumes, making it a cost-effective solution for many use cases. Additionally, serverless provides automatic scaling, so you don't have to worry about overprovisioning or underprovisioning resources. This allows you to build and deploy applications faster and with less operational overhead. While there are many providers for serverless functions, in this blog post we will be focusing on AWS Lambda. + +## Preparing your Go environment for AWS Lambda + +Before we begin writing our function, we need to prepare our Go environment. First, we will create a new module that will contain our code. To do this, we can use the `go mod init` command. + +```bash +go mod init github.com/my-user/GoLambda +``` + +Now that our module is set up, we can add dependencies using `go get`. To use AWS Lambda, we need the AWS lambda package. Let's add that to our module. + +```bash +go get github.com/aws/aws-lambda-go/lambda +``` + +## Our First Lambda Application + +Now that we have the necessary dependencies, we can create a file that will store our lambda handler. We can use the example file found in [https://github.com/aws/aws-lambda-go](http://github.com/aws/aws-lambda-go) to create our first Lambda handler. + +```go +// main.go +package main + +import ( + "github.com/aws/aws-lambda-go/lambda" +) + +func hello() (string, error) { + return "Hello Ī»!", nil +} + +func main() { + // Make the handler available for Remote + // Procedure Call by AWS Lambda + lambda.Start(hello) +} +``` + +Let's break down what this file is doing. Our `main()` function is calling `lambda.Start()` on our `hello()` function. The function `lambda.Start(hello)` is telling Lambda to use our `hello()` function to process any requests made to our lambda application. So, when our Lambda application is called, our Go code will call `hello()`, which simply returns the string `"Hello Ī»!"`. + +## Something a Little More Complex + +Now that we have the basics on how to make a very simple AWS Lambda serverless application, lets use our knowledge to create an application that actually does something useful and deploy it to Lambda. Our application will take a JSON formatted request of two numbers, `A` and `B` and return the greatest common factor, also in JSON format. + +To get started, lets modify our code with new structures that will define the format of our requests and responses, and a new handler function that will handle the requests from Lambda. + +```go +// main.go +package main + +import ( + "context" + + "github.com/aws/aws-lambda-go/lambda" +) + +type Request struct { + A int + B int +} + +type Response struct { + Result int +} + +func HandleRequests(ctx context.Context, req Request) (Response, error) { + return Response{}, nil +} + +func main() { + // Make the handler available for Remote + // Procedure Call by AWS Lambda + lambda.Start(HandleRequests) +} +``` + +Let's go over what we have changed. + +The `Request` structure defines how our requests to the lambda function will be formatted. We can see that inside the structure are the two integers that we will be finding the GCF of. + +The `Response` structure defines how our response from Lambda will be send back to the requestor. + +We have changed our handler function from `hello()` to `HandleRequests()`. The `HandleRequests()` function takes two arguments: + +- A context object that stores the context of the request being made to Lambda. +- The Request object that stores the actual values of the request. + +Now we can add the logic into our application. We will use the Euclidean algorithm to determine the greatest common factor of the two numbers, and return the result in our `Response{}` structure. + +```go +// main.go +package main + +import ( + "context" + + "github.com/aws/aws-lambda-go/lambda" +) + +type Request struct { + A int + B int +} + +type Response struct { + Result int +} + +func GCF(a, b int) int { + for b != 0 { + t := b + b = a % b + a = t + } + return a +} + +func HandleRequests(ctx context.Context, req Request) (Response, error) { + return Response{Result: GCF(req.A, req.B)}, nil +} + +func main() { + // Make the handler available for Remote + // Procedure Call by AWS Lambda + lambda.Start(HandleRequests) +} +``` + +## Deploying our Application + +### Compiling for Lambda + +Now that our code is ready, we need to deploy the application to Lambda. To do this, first we need to compile our code. In order to compile into a binary that is readable by the Lambda environment, we need to make sure Go compiles for a linux amd64 system. We can do this with this command in our terminal: + +```bash +GOOS=linux GOARCH=amd64 go build -o GoLambda main.go +``` + +Or on Windows Powershell (make sure you return the values to their defaults once you are done compiling), + +```powershell +$env:GOOS = "linux" +$env:GOARCH = "amd64" +go build -o GoLambda main.go +``` + +This will compile our code into a binary called `GoLambda`. Then, we need to zip the binary. On Linux and MacOS, we can just use the command + +```bash +zip lambda-handler.zip GoLambda +``` + +If you are on Windows, you must first install the build-lambda-zip utility in order to get a zip file that can be properly read by Lambda. + +```bash +go.exe install github.com/aws/aws-lambda-go/cmd/build-lambda-zip@latest +``` + +Then run this command to zip the binary (assuming you have a default Go installation). + +```bash +~\Go\Bin\build-lambda-zip.exe -o lambda-handler.zip bootstrap +``` -Lorem markdownum nunc _adfuit_ fecisse, `quae pectus`, quod seu mortale suo -Minerva iussit obortas. Favilla victa; alarum signis barbara, nec _sibi dentes_ -hostes? +### Deploying to Lambda -## Corporibus Leucon +Now that we have a zipped binary file, we can deploy our function to Lambda. Go into your AWS console and create a new lambda function. We will name our function GoLambda and use the Go 1.x runtime. Leave everything else default and hit `Create Function`. Once our function is created, we can upload our code. Under `Code Source`, choose to `.zip file`, and upload to your lambda-handler.zip file that we just created. -Quaeque viridis, pariter possit. Velatus Thetis, ab Buten, in et ite positis -annis ut Troasque altaque. Ancaeus convertit conscia Phinea petis. Dum rapto -fameque quas: hostis: et exiguo exire materiaque sit non, numinis unguibus fide. -Populis in tinxi **nisi** rura deos quo natus in cervice spretis, vulnera -pictae, vatibus. +When our code is uploaded, we need to edit the Runtime Settings and set the handler to be the name of our binary (in this case, GoLambda). -> Illi tenebras si vultum suae. Matrem iam: iniqua adire, tetigere meque, -> cessant, gerebat. +### Testing our Application -## Montes ignarus precor rogabam primus ridet sanguine +To make sure our function works as intended and didn't encounter any errors when uploading, we can create a test for our function. To make the test, we can go to the testing tab in our function's console and create a new event. We can call our event myTest, and edit the JSON to be as follows: -In vir indefessus et patrios veniam. Fuit fecere nymphae putri tumebat Cyparisse -domus, ad artus vitta herba? Et gaudet pressum aeterna animam. Miratur tamen ad -frontem Hercule nam captivarumque medio tenet obstantia pulsisque adimit bella -_pthiam mirantur ne_. +```json +{ + "A": 36, + "B": 48 +} +``` -> Lacertis et nomenque oracla exstabat: genitor nitor! Fluctus habes extinctum. -> Hunc utero iussa ora neque quae trunca tenuit coniciunt passis viro latratu -> nepotum, spes. Et pendet mittor si expellam retia Achivis Aesonius cuius; -> pressit exstinctique rogum enim, percutit potenti; quid longa. Nostra animaque -> genetrice viae, quam virus sermone in videri. +Then, just click `Test`. Our test will run, and you should get a dialogue box with the message **Execution result: succeeded** and our Response payload. -## Rapit harundine vana +```json +{ + "Result": 12 +} +``` -Noctis et et carpis corpus amplexus; imagine indignanda pedum sospes; cornua -super **et simus**. Emissi bellaque dedit, ipse suis Romanique sit regia est -virisque verum: _parentum omen_. Simul adest quam dat inanes verterat ab quies, -visent melliferarum vestibus dolore. +## Conclusion -Vos illo in habet, ipse est suo fuit, solidissima invecta moverent [si] pericula -ea pelle te quatiens proditus. Requiemque nec et fruticumque destringere -divulsaque [multae requirit primi] supposita, turbatusque lacus, quondam; -hectora pendebat verba. Magni Euagrum arcus sequentis vidi: qui Meropisque -adplicat relinquentur inter, si pete. Magna constitit ore rediit et parentis -pomaria lumina seque aura. +That's it! Our Go Lambda serverless application is now live. Now that you have a basic understanding of how Go Lambda functions work, you can use this basic structure to build more and more advanced solutions. And as always when you are learning with AWS +services, remember to destroy anything you have created to avoid any unwanted bills. -[multae requirit primi]: http://heu.io/ -[si]: http://infelixlucina.net/mutati +*You can find the code for this post at github.com/gabehf/GoLambda* \ No newline at end of file diff --git a/src/content/posts/02-untitled.md b/src/content/posts/02-untitled.md deleted file mode 100644 index e3162f5..0000000 --- a/src/content/posts/02-untitled.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Untitled" -publishedAt: 2023-05-24 -description: "Lorem ipsum dolor sit amet consectetur et ultrices blandit neque ege" -slug: "untitled" -isPublish: true ---- - -## Hello World diff --git a/src/data/config.ts b/src/data/config.ts index f13bd03..85f3bfd 100644 --- a/src/data/config.ts +++ b/src/data/config.ts @@ -1 +1 @@ -export const SITE_URL = "https://demo.maxencewolff.com/"; +export const SITE_URL = "https://mnrva.dev/"; diff --git a/src/data/presentation.ts b/src/data/presentation.ts index 381030d..6629fdb 100644 --- a/src/data/presentation.ts +++ b/src/data/presentation.ts @@ -12,23 +12,18 @@ type Presentation = { }; const presentation: Presentation = { - mail: "maxencewolff.pro@gmail.com", - title: "Hi, I’m Maxence šŸ‘‹", + mail: "gabe@mnrva.dev", + title: "Hey, I’m Gabe šŸ‘‹", // profile: "/profile.webp", description: - "Bonjour, i'm a *french frontend developer* with over *3 years* of web experience. I am currently working with *NextJS and Typescript*. Outside of work I complete my pokemon card collection and learning TypeScript.", + "I'm a recent *CS graduate* with professional *full stack development* experience.\ + You will often find me working with *Go, NodeJS and Python*. I love\ + to spend my time learning everything I can about emerging technologies in *cloud computing* and\ + *API development*. When I'm not working, I play guitar and am an avid gamer.", socials: [ { - label: "X", - link: "https://twitter.com/itsstormzz_", - }, - { - label: "Bento", - link: "https://bento.me/m-wolff", - }, - { - label: "Github", - link: "https://github.com/MaeWolff", + label: "View my GitHub šŸ”•", + link: "https://github.com/gabehf", }, ], }; diff --git a/src/data/projects.ts b/src/data/projects.ts index 96882be..9dfcce2 100644 --- a/src/data/projects.ts +++ b/src/data/projects.ts @@ -7,20 +7,19 @@ export type Project = { const projects: Project[] = [ { - title: "Dictionary App", - techs: ["ReactJS (NextJS)", "react-query", "zod"], - link: "https://github.com/MaeWolff/dictionary-app", + title: "Massflip", + techs: ["Go", "Vue.js", "AWS", "MongoDB"], + link: "https://github.com/gabehf/massflip", }, { - title: "Portfolio / Lina BLIDI", - techs: ["ReactJS (NextJS)", "TypeScript"], - link: "https://www.linablidi.fr/", + title: "CostIn.Coffee", + techs: ["HTML/CSS/JS", "jQuery"], + link: "https://costin.coffee", }, { - title: "Portfolio / Template", - techs: ["Astro"], - link: "/", - isComingSoon: true, + title: "Budget Buddy", + techs: ["React", "Go", "MongoDB"], + link: "https://github.com/gabehf/budgetbuddy", }, ]; diff --git a/src/data/theme.ts b/src/data/theme.ts index cf5876a..b1c9dde 100644 --- a/src/data/theme.ts +++ b/src/data/theme.ts @@ -12,10 +12,10 @@ type Theme = { const theme: Theme = { colors: { - primary: "orange", + primary: "cyan", blur: { - top: "orange", - bottom: "violet", + top: "cyan", + bottom: "indigo", }, }, }; diff --git a/src/pages/index.astro b/src/pages/index.astro index d891b74..511f95c 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -40,7 +40,7 @@ const posts = (await getCollection("posts")).sort(function (first, second) {

diff --git a/src/pages/posts/[slug].astro b/src/pages/posts/[slug].astro index 623df06..128607e 100644 --- a/src/pages/posts/[slug].astro +++ b/src/pages/posts/[slug].astro @@ -21,7 +21,7 @@ const { Content } = await post.render(); --- -
+

{post.data.title} - {formatDate(post.data.publishedAt)} diff --git a/src/utils/textThemeColorTag.ts b/src/utils/textThemeColorTag.ts new file mode 100644 index 0000000..1461d40 --- /dev/null +++ b/src/utils/textThemeColorTag.ts @@ -0,0 +1,6 @@ +import theme from '@/data/theme' +import { MAP_COLOR_VARIANT_TO_TEXT } from "./mapVariants"; + +export default function textThemeColorTag() { + return MAP_COLOR_VARIANT_TO_TEXT[theme.colors.primary] +}