Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tristanls on github.
  • I am tristanls (https://keybase.io/tristanls) on keybase.
  • I have a public key ASBa6_-Unbrn-U6KcZ0BDRic8CiEH6rfCm6LyTDKDa9xOAo

To claim this, I am signing this object:

@tristanls
tristanls / non_interactive_java_download.md
Created March 8, 2018 23:22
non-interactive Java download
$ curl -LO -b "oraclelicense=a" http://download.oracle.com/otn-pub/java/jdk/9.0.4+11/c2514751926b4512b076cc82f959763f/jdk-9.0.4_linux-x64_bin.tar.gz
@tristanls
tristanls / serverless_contexts.md
Created August 29, 2017 15:48
Contexts where Serveless was useful or not.

Contexts where Serverless turned out useful:

  • When setting up a service control plane (for example commands such as CreateTenant, or DeleteTenant) Serverless is useful as the commands aren't executed often, and the latency is not really a constraint.
  • Processing events from an event stream up to a certain throughput when cost starts to dominate and running dedicated servers (which possibly is "roll your own serverless") becomes a more economical choice.

Contexts where Serverless didn't work well:

  • When setting up a service data plane (for example, proxying a request with minimal latency), Serverless doesn't work well
@tristanls
tristanls / Capability URI Scheme.md
Last active June 27, 2017 00:32
Capability URI Scheme

Capability URI Scheme

The "cpblty" scheme is used to identify capabilities.

There are two types of "cpblty" URIs. They are distinguished by the mechanism used to identify the authority responsible for resolving the capability.

The first type of capability URI uses IP address or DNS resolution to identify authority.

@tristanls
tristanls / secure-local-storage-demo.js
Created June 19, 2016 19:18
Demo of securing local storage with encryption.
"use strict";
const crypto = require("crypto");
const http = require("http");
const url = require("url");
const indexHtml =
`<!doctype html>
<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->
<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]-->
@tristanls
tristanls / gist:b47430985858978669b7
Created May 13, 2015 01:12
example json response
{
"message": "hello there",
"status": "200 OK"
}
  1. General Background and Overview
@tristanls
tristanls / iso8601durationregex.js
Last active September 6, 2021 14:53
ISO-8601 Duration Regex
var iso8601durationregex = /^P([0-9]+(?:[,\.][0-9]+)?Y)?([0-9]+(?:[,\.][0-9]+)?M)?([0-9]+(?:[,\.][0-9]+)?D)?(?:T([0-9]+(?:[,\.][0-9]+)?H)?([0-9]+(?:[,\.][0-9]+)?M)?([0-9]+(?:[,\.][0-9]+)?S)?)?$/
dostuffEmitter.on('task1', function (callback) {
dostuffEmitter.emit('task3', x, callback);
});
dostuffEmitter.on('task2', function (x, callback) {
dostuffEmitter.emit('finish', y, callback);
});
dostuffEmitter.on('task3', function (y, callback) {
dostuffEmitter.emit('task2', z, callback);
dostuffEmitter.on('task2', function (x, callback) {
if (error) {
dostuffEmitter.emit('error', error);
return;
}
dostuffEmitter.emit('telemetry', someMetricHere);
dostuffEmitter.emit('task3', y, callback);
});