Skip to content

Instantly share code, notes, and snippets.

View reggi's full-sized avatar
🌺
Learning

Reggi reggi

🌺
Learning
View GitHub Profile
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 {

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.
@reggi
reggi / glob-up-and-running.md
Last active November 26, 2024 05:58
A tutorial on how to get started using glob patterns in your terminal. #writing

Glob Up and Running

To test a glob pattern go over to globtester and play around with creating your own file structure online, it's super easy to get started that way.

If you want to test out a glob pattern in the terminal use echo followed by the pattern, for instance.

echo **/*.js
@reggi
reggi / anime.yml
Last active September 22, 2024 17:12
-
name: Delicious in Dungeon
date: August 2024
rating: 10/10
thoughts: "Really cozy vibes, love the world building and the characters. The art is also really good."
-
name: "Frieren: Beyond Journey's End"
date: September 2024
rating: 10/10
thoughts: "I view this as a retrospect on life and our life-spans, regret, death and the friends you make along the way."
#!/bin/bash
# Get the list of dependencies from package.json
DEPENDENCIES=$(jq -r '.dependencies | keys[]' package.json)
# Loop through each dependency
for DEP in $DEPENDENCIES; do
# Get the path to the dependency's package.json
DEP_PACKAGE_JSON="node_modules/$DEP/package.json"
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')
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
@reggi
reggi / socket-io-emit-async.js
Last active June 4, 2024 08:46
Socket.io emit async
var io = require('socket.io-client')("http://localhost:3001")
var Promise = require("bluebird")
io.emitAsync = Promise.promisify(io.emit)
io.emitAsync("report", {
"name": "thomas"
}).then(function(data){
console.log(data)
}).catch(function(e){
console.log(e.message)
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() {