Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View robey's full-sized avatar

Robey Pointer robey

View GitHub Profile
@robey
robey / long tweet.md
Last active April 13, 2017 08:36
long tweet

https://twitter.com/ceejbot/status/852323661591728128

i can't get more than halfway through this article. i just... can't.

the author means well, but he gets most of the history jumbled so that it doesn't make any sense. (which is understandable, since he didn't join until 2013, years after all of that history happened)

i think he's trying to tell a story about how a bunch of disorganized engineering could have gone better if it had a team of support engineers, but the real story is hidden in plain sight. he mentions it over and over again. an entire new team is bought but never integrated with the existing team. "directors" make engineering decisions by fiat, and quit (or are resigned)

@robey
robey / simplified-future.md
Last active April 10, 2017 20:00
Changing the shape of rust Future & Stream

Changing the shape of rust Future & Stream

On the tokio chat, @carllerche suggested that one way to simplify the "errors on streams" problem (rust-lang/futures-rs#206) would be to remove the error alternative from Future & Stream. This idea stuck with me, and I want to sketch out a possible alternative, to see how it would look.

Currently

  • Future<Item, Error>: A future resolves to either an item or an error type, exactly like an async version of Result.
    • poll() -> Poll<Item, Error>: not ready, or an item, or an error
  • Stream<Item, Error>: A stream emits elements that are each either an item or error, exactly like an async iterable of Result.
    • poll() -> Poll<Option<Item>, Error>: not ready, or the end of the stream (Ready(None)), or an item, or an error
use futures::{Async, Future, IntoFuture, Poll, Stream};
enum State<St, Fut> {
/// No active future is running. Ready to call the function an process the next future.
Ready(St),
/// Currently polling this future.
Working(Fut),
/// Stream ended!
type ByteStream = Stream<Item = EasyBuf, Error = io::Error>;
// pub fn framed_stream<T>(s: T) -> impl T
// where T: Stream<Item = EasyBuf, Error = io::Error>
// convert a byte stream into a stream with each chunk prefixed by a length
// marker, suitable for embedding in a bottle.
pub fn framed_stream<T>(s: T) -> stream::Flatten<
"use strict";
// 2862933555777941757 == 0x27bb2ee687b0b0fd
const PRNG_LO = 0x87b0b0fd;
const PRNG_HI = 0x27bb2ee6;
/*
* jump consistent hash, as described here:
* http://arxiv.org/abs/1406.2294
*
@robey
robey / base32.ts
Created September 22, 2016 21:42
fast browser-friendly base32 codec
// base32 implementation for fun.
const alphabet = "0123456789abcdefghjkmnpqrtuvwxyz";
if (alphabet.length != 32) throw new Error("Base 32 requires a 32-character alphabet");
// chars that look similar (dwim):
const alias = { o: 0, i: 1, l: 1, s: 5 };
const reverseLookup = buildReverseTable();

~ limoncello ~

based on this old gizmodo article

careful: by my calculation, this is 100 proof when complete, more than a strong whiskey

day 1

  • 2 lemons, cleaned & rinsed
  • 750 mL of 151

desires

  • 16 registers -- 8 might be sufficient with rotating registers
  • 24-bit addressing = 16MW memory max
  • all code addresses relative (PIC)
  • memory protection table: readable, writable, executable
  • no "status" register: flags that can be set by comparisons, and used for conditions, and which are pushed during a call
  • rotating register space and spill, instead of a stack
  • real register space of (64?) registers treated as a ring
@robey
robey / server.es6
Created September 19, 2015 17:15
simple restify API server for answering XHR requests
"use strict";
import restify from "restify";
const PORT = 8080;
export function main() {
const server = restify.createServer({ name: "api" });
server.use(restify.queryParser());
@robey
robey / write-build.js
Created July 23, 2015 18:14
make a build.json with git history.
#!/usr/bin/env node
"use strict";
var child_process = require("child_process");
var fs = require("fs");
var path = require("path");
var strftime = require("strftime");
var util = require("util");
var pjson = JSON.parse(fs.readFileSync("package.json", "utf8"));