Skip to content

Instantly share code, notes, and snippets.

View mtrojas's full-sized avatar
🤓

María Teresa Rojas mtrojas

🤓
  • Sticker Mule
  • Lisboa, Portugal
View GitHub Profile
// requireAllowed(nameList) rejects any URL name not in the provided whitelist.
func requireAllowed(nameList []string) func(http.Handler) http.Handler {
allowed := map[string]struct{}{}
for _, n := range nameList { allowed[n] = struct{}{} }
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
name := chi.URLParam(r, "name")
if _, ok := allowed[name]; !ok {
http.Error(w, "Forbidden", http.StatusForbidden)
return
@mtrojas
mtrojas / dependabot.yml
Last active June 9, 2025 10:16
Example Dependabot configuration file for Lego
version: 2
updates:
# Enable version updates for go.mod
- package-ecosystem: "gomod"
# Look for a `go.mod` file in the `root` directory
directory: "/"
# Check for updates once a month
schedule:
interval: "monthly"
# Update only explicitly defined dependencies
#!/usr/bin/env bash
set -euo pipefail
ISLAND_PATH="$1"
PACKAGE_JSON="$ISLAND_PATH/package.json"
YARN_LOCK="$ISLAND_PATH/yarn.lock"
echo "🔍 Reading production dependencies from $PACKAGE_JSON"
#!/usr/bin/env bash
set -euo pipefail
ISLANDS_DIR="re-store/islands"
TMP_ALL_DEPS="/tmp/all-packages.txt"
TMP_UNIQUE="/tmp/unique-packages.txt"
TMP_PER_ISLAND="/tmp/island-deprecated"
> "$TMP_ALL_DEPS"
@mtrojas
mtrojas / deprecated.txt
Created May 21, 2025 16:43
Deprecated packages per island
📊 Deprecated packages per island:
🔹 about-frontend:
⚠ @zeit/next-css@1.0.1 Next.js now has built-in support for CSS: https://nextjs.org/docs/basic-features/built-in-css-support. The built-in support solves many bugs and painpoints that the next-css plugin had.
⚠ core-js@3.6.5 core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
⚠ google-p12-pem@3.1.2 Package is no longer maintained
⚠ rimraf@3.0.2 Rimraf versions prior to v4 are no longer supported
⚠ glob@7.1.6 Glob versions prior to v9 are no longer supported
⚠ inflight@1.0.6 This module is not suppo
#!/usr/bin/env bash
set -euo pipefail
INPUT_FILE=${1:-packages.txt}
CONCURRENCY=${2:-16} # number of concurrent jobs
echo "⚡ Running yarn info in parallel from: $INPUT_FILE"
echo "🔄 Concurrency: $CONCURRENCY"
start=$(date +%s)
#!/usr/bin/env bash
set -euo pipefail
INPUT_FILE=${1:-packages.txt}
echo "📦 Profiling yarn info over packages in: $INPUT_FILE"
echo
start=$(date +%s)
#!/usr/bin/env bash
set -euo pipefail
TARGET_DIR=${1:-.}
cd "$TARGET_DIR"
echo "🔍 Measuring yarn list + jq parsing in: $TARGET_DIR"
echo
start=$(date +%s)
@mtrojas
mtrojas / sizes2.go
Created March 15, 2024 19:19
Go script to obtain image file sizes from GCP Storage
package main
import (
"bufio"
"context"
"fmt"
"log"
"os"
"cloud.google.com/go/storage"
@mtrojas
mtrojas / sizes.go
Created March 15, 2024 14:26
Go script to obtain image file sizes from GCP Storage
package main
import (
"bufio"
"context"
"fmt"
"log"
"os"
"strings"