Skip to content

Instantly share code, notes, and snippets.

View fare's full-sized avatar

François-René Rideau fare

View GitHub Profile
@fare
fare / api.md
Created October 14, 2024 16:50
First draft for Sky API

Availability API

Types

(deftype :signature (:byte-vector 64)) ;; ????
(deftype :hash (:byte-vector 32))
(deftype :topic :hash)
(deftype :data-block :byte-vector)
(deftype :block-certificate :signature)
(deftype :sky-connection ...)
@fare
fare / keybase.md
Created July 21, 2018 20:12
keybase proof

Keybase proof

I hereby claim:

  • I am fare on github.
  • I am fahree (https://keybase.io/fahree) on keybase.
  • I have a public key ASDY4Ks-hdLvBqTl4DYmUK5RmbfOYIA2V2W0UtbzmzkxtAo

To claim this, I am signing this object:

@fare
fare / What do Formal Methods actually Guarantee.csv
Created June 26, 2018 02:00
What do Formal Methods actually Guarantee?
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
"Limits to Formal Methods","What Formal Methods CAN do"
"Formal methods are not a magic powder that you can sprinkle over your code to make it correct.","Formal methods are a structural backbone around which you can develop more robust code."
"Formal methods are only methods. You still need to apply them correctly, to the right things to have useful results.","When applied correctly, formal methods can eliminate not only single bugs, but entire classes of bugs and attacks, that your model can express as absent."
"Formal methods won’t prevent bugs on aspects of your code that you haven’t formalized yet.","Formal methods can ensure the non regression of your code with respect to those classes of defects you formalized. Unlike other methods, they provide a ratchet that ensures progress even as the code evolves."
"Formal methods can’t eliminate bugs and prevent attacks that go below the model you use (e.g. SPECTRE attack).","Formal methods allow you to reason at one high level of abstraction and transport your re
@fare
fare / case-lambda-bug.ss
Created February 17, 2018 01:57
case-lambda works in the interpreter, only accepts the base case in the compiler
;; works with Gerbil v0.12-DEV-1315-g5902327 on Gambit v4.8.8-434-g490f0a7d on nixpkgs 867d3f9 (gcc 7.2.0)
;; fails with Gerbil v0.12-DEV-1404-g0a266db on Gambit v4.8.8-435-gd1991ba7 on nixpkgs dafdaa9 (gcc 7.3.0)
package: bug
(export #t)
(import :clan/utils/assert)
(def foo (case-lambda (() 0) ((x) 1) ((x y) 2) ((x y z . t) (+ 3 (length t)))))
@fare
fare / nest.ss
Created August 22, 2017 01:25
Trying to nest a helper inside a macro...
#lang racket
(define-syntax defsyntax (syntax-rules () ((_ x ...) (define-syntax x ...))))
;; These two work:
(defsyntax Rnest
(syntax-rules ()
((_ (rev ...) (one more ...)) (Rnest (one rev ...) (more ...)))
((_ () ()) ())
((_ (x) ()) x)
((_ (x (y ...) z ...) ()) (Rnest ((y ... x) z ...) ()))))
@fare
fare / default.nix
Created May 15, 2017 01:03
Nix support for gerbil
# pkgs/development/compilers/gerbil/default.nix
# Note: this supposes Gambit was compiled with
# "--enable-single-host"
# "--enable-shared"
# "--enable-absolute-shared-libs"
# "--enable-c-opt=-O6" "--enable-gcc-opts" "--enable-inline-jumps"
# "--enable-thread-system=posix" "--enable-dynamic-tls"
# "--enable-openssl"
{ stdenv, fetchurl, fetchgit, gambit, openssl, zlib, coreutils, rsync }:
@fare
fare / Context.scala
Created December 22, 2016 03:43
Context passing in Scala
trait IsContext {
def contextualContent: List[HasContext[this.type]] = List()
contextualContent.map { item => item.setContext(this) }
}
trait HasContext[+Context] {
private var ctx: Any = null
def setContext(context: Any) {
assert(ctx == null)
ctx = context
}