Skip to content

Instantly share code, notes, and snippets.

View belisarius222's full-sized avatar

Ted Blackman belisarius222

View GitHub Profile
@belisarius222
belisarius222 / hark.hoon
Last active August 24, 2020 16:34
hark: notification types
|%
:: $hark: general-purpose notification
::
:: Arguably .link should be a $beam, not a path, but $path is a bit
:: more general and can easily encode a beam. The idea is that each
:: notification should be able to point to the part of the system
:: that generated it, so that if the user clicks the link, they will
:: be taken to the relevant part of an application.
::
:: The link could refer to just the application that generated the
@belisarius222
belisarius222 / ford-fusion-writeup.md
Last active August 5, 2020 14:17
ford fusion writeup

Ford Fusion

Overview and Rationale

Ford Fusion was an overhaul of Urbit's over-the-air upgrade process and a rewrite of its build system. The new update system corrects a few long-standing bugs with the previous one, and the new build system is simpler, smaller (by around 5,000 lines), and easier to manage.

Since deployment of Ford Fusion to the livenet in late June, over-the-air updates (OTAs) have been much smoother. Before Ford Fusion, it was common for an OTA to take several hours, use too much memory, and leave ships in inconsistent states. After Ford Fusion, multiple OTAs have been pushed out, including kernelspace changes, and most users didn't even notice.

Urbit has always been able to update itself OTA, but this process has often been rocky. Updating an operating system kernel on-the-fly is a difficult problem in general, like performing heart replacement surgery on yourself while running a marathon. Code that allows Linux to update its kernel in this way became a startup called Ksplice, won

@belisarius222
belisarius222 / state-monad.hoon
Created February 25, 2020 09:27
state monad in hoon
=< (do-some-stack-ops ~[1 2 3])
|%
++ do-some-stack-ops
=/ liz (list @)
=/ st (stack @)
=/ m (stat liz @)
^- form:m
;< empty=? bind:m is-empty:st
?. empty
pop:st
@belisarius222
belisarius222 / w.hoon
Created August 26, 2019 02:09
Algorithm W for Hindley-Milner type inference
=>
|%
+$ exp
$~ [%lit %int 0]
$% [%var =var]
[%lit =lit]
[%app fun=exp arg=exp]
[%abs =var bod=exp]
[%let =var val=exp bod=exp]
==
@belisarius222
belisarius222 / mung.hoon
Last active July 3, 2020 23:09
mung: better mug (inspired by @frodwith)
|%
:: +mung: 31-bit non-zero murmur3-32 based merkle hash
::
++ mung
~/ %mung
=/ syd 0xcafe.babe
|= n=*
^- @
?^ n
$(n (con $(n -.n) (lsh 0 31 $(n +.n))))
@belisarius222
belisarius222 / cone.hoon
Last active May 21, 2020 23:26
$cone: a definition of type for Nock trees, surjective from hoon $type's with no cores
=>
|%
+$ cone
$@ %noun
$% [%back ix=@ud]
[%loop =cone]
[%cell p=cone q=cone]
[%face p=term q=cone]
[%atom =aura]
[%mote =aura val=@]
@belisarius222
belisarius222 / uruk.rs
Last active March 30, 2020 17:58
Uruk interpreter in Rust
extern crate num;
use num::bigint::{BigUint, ToBigUint};
use std::rc::Rc;
#[derive(Clone, Debug, Eq, PartialEq)]
enum Ur { S, K, J, D }
#[derive(Clone, Debug, Eq, PartialEq)]
enum Exp {
N(Ur),
@belisarius222
belisarius222 / ford-pinto.md
Last active March 17, 2020 22:26
Ford Pinto Spec

Ford Pinto - Smaller and Less Explosive

namesake

Overview and Rationale

Ford Turbo, the current incarnation of Ford, has some exciting features. In retrospect some of those features were the result of irrational exuberance. Many have been in Ford since the beginning.

Ford Pinto is an attempt to take a more measured look at which features Ford actually needs and to support only those features. The overall plan involves passing through Ford Pinto into Ford Focus, which will include performance tuning targeted at the major Ford use cases.

What is Ford actually used for? Building files, and doing mark operations, basically. The primary simplification I'm making to Ford in this revision is to separate those two interfaces. Ford runes other than simple imports have been removed, and there is now a strict layering where building a source file does not depend on mark builds.

@belisarius222
belisarius222 / monads.hoon
Created February 29, 2020 00:39
monads.hoon
|%
++ mebe
|* a=mold
|%
+$ form (unit a)
++ pure
|= arg=a
^- form
`u=arg
++ bind
@belisarius222
belisarius222 / ddp_log.js
Created January 10, 2013 07:24
patch client-side Meteor functions to print out the DDP messages. Add this somewhere in your client-side JS before Meteor.startup() and it should print out the DDP messages. Please let me know if there are some that are missing! I'm not sure I caught all of the handler functions.
var monkeyPatches = {
'_livedata_data': 'DATA',
'_livedata_error': 'ERROR',
'_livedata_nosub': 'NOSUB',
'_livedata_connected': 'CONNECTED',
'_livedata_result': 'RESULT',
};
_.each(_.keys(monkeyPatches),function(funcName){
var modifiedFunctionName = funcName+'_original';
var extension = {};