Skip to content

Instantly share code, notes, and snippets.

View michaelsmanley's full-sized avatar

Michael S. Manley michaelsmanley

View GitHub Profile
@johnston
johnston / data-star-CSRF.js
Created April 12, 2025 19:40
Automatically add a CSRF token to requests with data-star
import { load } from "@starfederation/datastar/bundles/datastar-core"
import * as plugins from "@starfederation/datastar/plugins"
// Function to get CSRF token from meta tag
const getCSRFToken = () => {
const meta = document.querySelector('meta[name="csrf-token"]')
return meta ? meta.getAttribute('content') : null
}
// Helper function to create CSRF-enabled HTTP method handlers
@markuman
markuman / README.md
Last active February 11, 2025 11:30
🗺️ OSM - self host the entire planet 🌎 in ~30 minutes 🚀

🗺️ OSM - self host the entire planet 🌎 in ~30 minutes 🚀

TL;DR

mkdir osm
wget -O osm/planet.mbtiles https://hidrive.ionos.com/api/sharelink/download?id=SYEgScrRe
podman run -ti --rm -p 9000:9000 --name sms -v $(pwd)/osm/:/data/ registry.gitlab.com/markuman/sms:latest
firefox http://localhost:9000
@cugu
cugu / README.md
Last active September 30, 2025 08:02
Webhooks for PocketBase

Webhooks for PocketBase

A simple webhook plugin for PocketBase.

Adds a new collection "webhooks" to the admin interface, to manage webhooks.

Example

The webhook record in the following example send create, update, and delete events in the tickets collection to http://localhost:8080/webhook.

@blineberry
blineberry / supportsWebmentionsBookmarklet.js
Last active September 27, 2025 15:29
Supports Webmentions? Bookmarklet
javascript: (() => {
// Set some strings for the common result scenarios.
const support = "Page supports webmentions!";
const noSupport = "Page does not support webmentions :(";
// Create a dialog element and insert into the DOM.
let d = document.createElement('dialog');
document.getElementsByTagName('body')[0].appendChild(d);
// Remove the dialog element when it's closed.
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
@gnat
gnat / index.html
Last active July 7, 2024 01:55
3D Card (Surreal + CSS Scope Inline)
<html>
<head>
<script src="https://gnat.github.io/css-scope-inline/script.js"></script>
<script src="https://gnat.github.io/surreal/surreal.js"></script>
</head>
<body>
<style>
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; }
body { font-family: system-ui, sans-serif; perspective: 1500px; background: linear-gradient(#666, #222); }
@dangovorenefekt
dangovorenefekt / blockmetatwitter.md
Last active January 14, 2025 22:25
Block Meta and Twitter (nginx)
@osher
osher / sops-with-age-encryption.demo.sh
Last active April 13, 2025 13:20
The simplest sops demo - sops using age encryption
# This demo uses an alpine sandbox in a docker container in
# interactive mode. ran with:
# docker run --rm -it alpine
#
# if you run it on your own system:
# 1. you should use your own package manager instead of `apk`
# 2. expect the following left overs:
# - installed binaries (age, age-keygen, sops)
# - $HOME/.config/sops/age/keys.txt
# - demo files: source.env, encrypted.env, decrypted.env