dios disk format
the disk block size is 1KB, or 512 words. each disk has 18 tracks of 80 sectors, or 1440 blocks. a hypothetical hard drive could have up to 64k blocks (64MB) using an addressing scheme of one word block ids.
#include <algorithm> | |
#include <functional> | |
#include <string> | |
#include <vector> | |
template<typename A, typename Func> auto map_3(const A& orig, Func f) -> std::vector<decltype(f(begin(A())))> { | |
std::vector<decltype(f(begin(A())))> rv; | |
rv.resize(orig.size()); | |
std::transform(begin(orig), end(orig), begin(rv), f); | |
return rv; |
;---------------------------------------------------------------------------- | |
; AES encryption for the DCPU. | |
;---------------------------------------------------------------------------- | |
; Fits into 0x400 words, with its tables and key buffer. | |
; Initialize with a key, for encryption or decryption, then feed it a buffer | |
; of 16 bytes (8 words) at a time. Check out the unit tests at the end for | |
; example usage. | |
; | |
; Speed: SLOW! | |
; set_key varies from 3400-4400 cycles for encryption (based on key size); |
var Fonts = { | |
fontMemory: [ ], | |
fontSource: [ ], | |
// load font from image | |
loadFont: function(filename) { | |
var canvas = document.createElement('canvas'); | |
canvas.style.display = "none"; | |
document.body.appendChild(canvas); |
; ----- blit from B (len X) into C -- preserves A Y Z | |
:blit | |
ifl b, c | |
bra blit.backward.extern | |
:blit.forward.extern | |
set i, b | |
set j, c | |
add x, b | |
; blit from [I, X) forward into J | |
:blit.forward |
idempotent operations to store service metrics: we weren't able to come up with a good solution to this.
our rule of thumb for network failures was that packets will get lost, so you can have two behaviors for server operations:
at LEAST once: if a response gets lost, retry. you may end up doing the same operation twice.
at MOST once: if a response gets lost, give up. the operation might have been lost before the server saw it.
if your operations are idempotent, you can use "at least once" mode for everything. we did that for almost every server i can think of. it was an explicit design goal of flock (the social graph database) and finagle (the server-building toolkit).
16 registers: | |
/ / / / / / E F <- value registers (r0 - r5) | |
/ / / / / / S P <- index registers (a0 - a5) | |
E = extended (carry/rollover) result | |
F = flags: | |
set on result of each binary operation, or load into register | |
x x x x x x x x / Q x x x M N C Z | |
(Q) interrupts are queueing | |
(M) masked: in comparisons, left & right != 0 |
Using "terminal-notifier" here: https://github.com/alloy/terminal-notifier
Make a helper script for terminal-notifier to keep you from killing yourself:
$ cat ~/bin/terminal-notifier
#!/bin/bash
/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier "$@"
{$C-} { Ctrl-break doesn't stop us now! } | |
{ | |
ZEdit - WWIV full-screen editor | |
Command line: | |
ZEDIT [options] filename | |
Public ("official") releases: | |
v1.1 - May 30, 1989 |
task "test", run: -> | |
Q.all( | |
exec "long-ass process" | |
exec "another long-ass process" | |
) |