Skip to content

Instantly share code, notes, and snippets.

@mrkurt
mrkurt / fly-aws-sdk.js
Created July 13, 2018 18:48
Using the AWS SDK in a Fly App
import * as AWS from 'aws-sdk'
AWS.HttpClient.prototype.handleRequest = function handleRequest(httpRequest, httpOptions, callback, errCallback) {
var self = this;
var endpoint = httpRequest.endpoint;
var emitter = new EventEmitter();
callback(emitter);
var href = endpoint.protocol + '//' + endpoint.hostname;
if (endpoint.port !== 80 && endpoint.port !== 443) {
@mrkurt
mrkurt / regex.js
Last active October 10, 2018 15:59
Kurt
import proxy from "@fly/proxy"
import { forceSSL } from './lib/utilities'
const origin = proxy("https://viaglamour.com/")
/**
* Rewrite the path to /store/<hostname>
*/
function rewriteRequest(req) {
const url = new URL(req.url)
let path = "/store/" + url.hostname.replace(/\.[a-z]+/, '')
dist
lib
build
node_modules
.nyc_output
bin/fly
.fly
package-lock.json
yarn.lock
@mrkurt
mrkurt / ip-valuations.rb
Created February 16, 2021 18:35
Cloud provider IP valuations
require "ipaddr"
require "net/http"
require "uri"
require "json"
def fetch(uri_str, limit = 10)
# You should choose better exception.
raise ArgumentError, "HTTP redirect too deep" if limit == 0
url = URI.parse(uri_str)