Skip to content

Instantly share code, notes, and snippets.

View timshadel's full-sized avatar

Tim Shadel timshadel

View GitHub Profile
{
"photos": {
"href": "/photos",
"count": 154,
"collection": [
{
"href": "...",
"type": "image/jpeg",
"name": "beach.jpg"
}
@timshadel
timshadel / Internal stunnel S3 proxy.md
Last active February 13, 2021 22:12
Create a URL that can be used to issue a plain HTTP request to an internal stunnel proxy that will wrap it in HTTPS and send it on to S3.

S3 proxy

If you've got tools that don't speak HTTPS, then using stunnel in client mode you can wrap those requests in SSL on their way to S3. If you don't hijack the S3 DNS with iptables, then you'll need to send those URLs using the domain name of your internal stunnel proxy. This utility gives you one way to create those URLs. It's incomplete, and just to give you some ideas.

@timshadel
timshadel / .gitignore
Last active December 22, 2015 09:49 — forked from mbostock/.block
node_modules
@timshadel
timshadel / .gitignore
Last active December 22, 2015 09:29 — forked from mbostock/.block
node_modules

So the brilliance of hypermedia is that it's a protocol programming language: the client is the generic execution environment, and the server is the "programmer" which sends tiny little chunks of programs down to the client to dictate what actions may be taken next, given its context.

The fact that the client also builds a UI is irrelevant to this power. The power is in creating a dynamic, custom protocol by choosing for the client which message structures that will be sent from the client, which is done using merely the tools of hypermedia. The protocol between a client and server is then codified in the hypermedia (e.g. HTML) part of the code which uses links and forms to document the various messages which may pass between client and server, and the client states in which either may be used.

Armstrong's formula for a good protocol:

Client-State, Client-Message => Server-State, Server-Response-Message

But in hypermedia, the server's response dictate's the client state:

DEBUG=connect:something,fn=requestLogger
@timshadel
timshadel / api-stack.js
Last active December 16, 2015 09:59
Middleware stack config ideas.
/**
* Module dependencies.
*/
var stack = require("simple-stack-common")
, cors = require("connect-xcors");
/**
* Expose the stack
*/
module.exports = exports = function(config) {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/**
* Module dependencies
*/
var knox = require('knox')
, async = require('async')
, url = require('url');
/**
* node fixheaders.js s3://bucket/prefix
*/