Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tteggel's full-sized avatar

Thom Leggett tteggel

View GitHub Profile
@tteggel
tteggel / .gitignore
Created September 2, 2012 18:33
Cyclops
*.log
@tteggel
tteggel / keybase.md
Created March 11, 2015 20:25
keybase.md

Keybase proof

I hereby claim:

  • I am tteggel on github.
  • I am tteggel (https://keybase.io/tteggel) on keybase.
  • I have a public key whose fingerprint is 667C 8788 2225 32B8 1AFD E8F0 6ECA 37AF 0A9F CA4B

To claim this, I am signing this object:

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tteggel
tteggel / book-1.java
Last active November 22, 2017 16:35
Serverless Sagas with Fn Flow
public void book1(TripReq input) {
Flow f = Flows.currentFlow();
FlowFuture<BookingRes> flightFuture =
f.invokeFunction("./flight/book", input.flight, BookingRes.class);
FlowFuture<BookingRes> hotelFuture =
f.invokeFunction("./hotel/book", input.hotel, BookingRes.class);
FlowFuture<BookingRes> carFuture =
public void book2(TripReq input) {
Flow f = Flows.currentFlow();
FlowFuture<BookingRes> flightFuture =
f.invokeFunction("./flight/book", input.flight, BookingRes.class);
FlowFuture<BookingRes> hotelFuture =
f.invokeFunction("./hotel/book", input.hotel, BookingRes.class);
FlowFuture<BookingRes> carFuture =
private static <T> FlowFuture<T> _exponentialWithJitter(Flows.SerCallable<FlowFuture<T>> op, RetrySettings settings, int attempt) {
Flow f = Flows.currentFlow();
try {
FlowFuture<T> future = op.call();
return future.exceptionallyCompose((e) -> {
if (attempt < settings.maxAttempts) {
long delay_max = (long) Math.min(
settings.timeUnit.toMillis(settings.delayMaxDuration),
settings.timeUnit.toMillis(settings.delayBaseDuration) * Math.pow(2, attempt));
public void book3(TripReq input) {
Flow f = Flows.currentFlow();
FlowFuture<BookingRes> flightFuture =
f.invokeFunction("./flight/book", input.flight, BookingRes.class);
FlowFuture<BookingRes> hotelFuture =
f.invokeFunction("./hotel/book", input.hotel, BookingRes.class);
FlowFuture<BookingRes> carFuture =

Keybase proof

I hereby claim:

  • I am tteggel on github.
  • I am tteggel (https://keybase.io/tteggel) on keybase.
  • I have a public key ASAz42KeyYdYjLcHvlbf3CXozJ0EAz2iff3vyTf-U9nxrgo

To claim this, I am signing this object:

@tteggel
tteggel / take.js
Created July 22, 2020 15:06
Take n items as a batch from an asyncIterator until done
async function* take(n, obj) {
let done;
const iterator = obj[Symbol.asyncIterator]();
while(!done) {
yield Promise.all(
Array.from(
{length: n},
async function() {
const result = await this.next();
done = result.done;
@tteggel
tteggel / Firebase Password Hash.md
Last active August 3, 2020 11:40
How does Firebase Auth compute the stored password hash?

How does Firebase Auth compute the stored password hash?

User password is fed through crypto_scrypt (https://github.com/firebase/scrypt/blob/master/lib/crypto/crypto_scrypt.c) with the following parameters to generate a 512-bit key:

parameter value
password bytes from user password
passwordlen length of user password in bytes
salt 80 bit salt from a pseudo-random number generator as specified in section 10.1.2 of the NIST SP 800-90 standard + 8-bit separator
saltlen 11
N 16384