Skip to content

Instantly share code, notes, and snippets.

View reggi's full-sized avatar
🌺
Learning

Thomas Reggi reggi

🌺
Learning
View GitHub Profile

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
import ts from "npm:typescript";
import { readFileSync } from "node:fs";
function extractExportsFromFile(filePath: string): string[] {
// Read the file content
const fileContent = readFileSync(filePath, { encoding: 'utf8' });
if (!fileContent) {
throw new Error(`File not found or empty: ${filePath}`);
}
@reggi
reggi / ebay-preferences.user.js
Last active March 18, 2024 16:58
Greasemonkey / Tampermonkey Scripts
// ==UserScript==
// @name ebay-preferences
// @namespace https://reggi.github.io/
// @version 1.0.0
// @description My ebay preferences
// @author Thomas Reggi
// @match https://www.ebay.com/*
// ==/UserScript==
(function() {
AES-128-CBC
AES-128-CFB
AES-128-CFB1
AES-128-CFB8
AES-128-CTR
AES-128-ECB
AES-128-OFB
AES-128-XTS
AES-192-CBC
AES-192-CFB
import { JSX, ComponentChild, VNode } from "https://esm.sh/v96/preact@10.11.2"
import render from 'preact-render-to-string'
// you need a way to ignore the type error for an async component
const asyncComponent = (component: (props: any) => Promise<JSX.Element>): (props: any) => JSX.Element => {
return component as any
}
const Alice = asyncComponent(async (props: { children: ComponentChild}) => {
const x = await Promise.resolve('Alice')
import { Plugin } from "$fresh/server.ts";
const sources = [
"https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/htmx.js",
"https://raw.githubusercontent.com/bigskysoftware/htmx/dev/src/ext/head-support.js"
]
export default function htmx(): Plugin {
const main = `data:application/javascript,${sources.map(s => `import "${s}";`).join('')} export default () => {}`
return {
@reggi
reggi / github-milestones-redirect.js
Last active January 4, 2024 18:22 — forked from lospoy/github-milestones-redirect.js
Redirects GitHub's Milestones to a specific Sort
// ==UserScript==
// @name GitHub Milestones Redirect
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Redirects to GitHub milestones with specific parameters on link click
// @author You
// @match https://github.com/*
// @grant none
// ==/UserScript==
@reggi
reggi / h-frag.ts
Last active December 12, 2023 21:15
import { WebComponent, html } from 'web-component-base'
class HFrag extends WebComponent {
static props = {
as: 'h1',
hover: false
}
text: string
constructor () {
@reggi
reggi / objects.liquid
Last active December 7, 2023 01:14
How to do objects in liquid. Would love any feedback in comments
{% assign persons_delimiter = "!#$persons!#$" %}
{% assign person_delimiter = "!#$person!#$" %}
{% assign persons = "" %}
{% assign person = "" %}
{% assign person = person | append: "thomas" | append: person_delimiter %}
{% assign person = person | append: "This is for the fast talker. The message perfectly resonates with the go getter who puts their best foot forward, and is loving life. The colors are bright and aren’t dismal, which is a joy to look at. It’s aggressive and bold and really packs a punch." | append: person_delimiter %}
{% assign person = person | append: "Do No Harm Poster" | append: person_delimiter %}
{% assign persons = persons | append: person | append: persons_delimiter%}
---
type Props = {
id?: string,
class?: string,
value?: number,
onchange?: string,
style?: string,
hideSelector?: boolean,
showSelectorOnHover?: boolean
}