Skip to content

Instantly share code, notes, and snippets.

@upphiminn
upphiminn / agent.md
Created December 28, 2025 12:19 — forked from steipete/agent.md
Agent rules for git
  • Delete unused or obsolete files when your changes make them irrelevant (refactors, feature removals, etc.), and revert files only when the change is yours or explicitly requested. If a git operation leaves you unsure about other agents' in-flight work, stop and coordinate instead of deleting.
  • Before attempting to delete a file to resolve a local type/lint failure, stop and ask the user. Other agents are often editing adjacent files; deleting their work to silence an error is never acceptable without explicit approval.
  • NEVER edit .env or any environment variable files—only the user may change them.
  • Coordinate with other agents before removing their in-progress edits—don't revert or delete work you didn't author unless everyone agrees.
  • Moving/renaming and restoring files is allowed.
  • ABSOLUTELY NEVER run destructive git operations (e.g., git reset --hard, rm, git checkout/git restore to an older commit) unless the user gives an explicit, written instruction in this conversation. Treat t
@upphiminn
upphiminn / bash_strict_mode.md
Created October 23, 2025 07:56 — forked from mohanpedala/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

Terraforming API Gateway to SQS queue

Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.

SQS

Start by creating the SQS queue.

resource "aws_sqs_queue" "queue" {
@upphiminn
upphiminn / .ts
Last active June 19, 2025 12:50
enrichments.ts
class EnrichmentBuilder {
constructor(baseEvent) {
this.baseEvent = baseEvent;
this.enrichments = [];
}
addEnrichment({ name, value, type, data }) {
const enrichment = { name, value };
if (type) enrichment.type = type;
if (data) enrichment.data = data;
@upphiminn
upphiminn / http_streaming.md
Created September 27, 2023 20:23 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on

@upphiminn
upphiminn / http2.js
Created October 1, 2019 12:26 — forked from davidgilbertson/http2.js
HTTP2 server with compression and caching
const http2 = require('http2');
const fs = require('fs');
const path = require('path');
const zlib = require('zlib');
const brotli = require('brotli'); // npm package
const PORT = 3032;
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/');
const cache = {};
@upphiminn
upphiminn / err.js
Last active February 6, 2019 22:25
err...
async function doSomething() {
return new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), 1000)
});
}
// Rejection case
async function doSomethingBad() {
return new Promise((resolve, reject) => {
setTimeout(() => reject("crap!"), 1000)
@upphiminn
upphiminn / airlines.xml
Last active November 8, 2019 11:48
Example of d3-ForceEdgeBundling on US airline routes graph.
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns
http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key id="x" for="node" attr.name="x" attr.type="double"/>
<key id="tooltip" for="node" attr.name="tooltip" attr.type="string"/>
<key id="y" for="node" attr.name="y" attr.type="double"/>