Skip to content

Instantly share code, notes, and snippets.

@tonyg
tonyg / inotifytest
Created November 7, 2018 12:25
Simple inotify-based watcher/rebuilder - e.g. 'inotifytest make foo' or 'inotifytest redo'
#!/bin/bash
# Heavily cut-down inotifymake
# Copyright © 2011 Mega Nerd, Pty Ltd
# Copyright © 2011-2012 Operational Dynamics Consulting, Pty Ltd
# Copyright © 2016 Tony Garnock-Jones
#
# The code in this file, and the program it is a part of, is made available
# to you by its authors as open source software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License version
@tonyg
tonyg / schema.diff
Last active October 18, 2018 19:27
diff --git a/pre.clean.sql b/post.clean.sql
index 81fd888..3e1da66 100644
--- a/pre.clean.sql
+++ b/post.clean.sql
@@ -65,7 +65,7 @@ CREATE TABLE Folders (
description VARCHAR,
creatorName VARCHAR,
creatorProfileUrl VARCHAR
-);
+, syncPolicyExtended VARCHAR DEFAULT 'SyncPolicyNotSet');
#lang racket
(provide (struct-out public-key)
(struct-out signature)
(struct-out secret-key)
read-signify-file
parse-pk
parse-sk
parse-sig
format-pk

One Approach to Easy and High Performance VMs

This is a lab that walks you through one approach to the challenge of how we can have easy and high performance language virtual machines.

It's designed to come after Mario Wolczko's lecture on a Concise and Opinionated History of Virtual Machines, and illustrates practically some of the concepts and techniques introduced there.

This lab is about just one approach to easy and high performance VMs, and that

@tonyg
tonyg / bitsyntax-slow-contracts.rkt
Created May 8, 2018 09:21
Test to help pin down slowness of execution due to TR-inserted contracts (?)
#lang racket
;; Example to pin down influence of contract checks at a typed/untyped
;; boundary on execution speed in the `bitsyntax` package.
;;
;; TO RUN:
;; - install the `bitsyntax` package.
;; - run this program.
;; - modify the file `bitstring.rkt` in the `bitsyntax` package to have
;; ".../no-check" at the end of its `#lang`.
;; - rerun the program.
@tonyg
tonyg / mainline-dht-singlefile-nologging.rkt
Last active July 19, 2022 13:47
Mainline BitTorrent DHT (Kademlia) implementation in Syndicate/rkt
#lang syndicate
;;;; # Mainline BitTorrent DHT implementation in 297 SLOC
;;;;
;;;; [Syndicate](http://syndicate-lang.org/) is a new, actor-style
;;;; approach to concurrency. Syndicate programs exchange state and
;;;; messages within *conversational contexts*.
;;;;
;;;; This program demonstrates Syndicate programming by implementing
;;;; the Mainline BitTorrent Distributed Hash-Table.
;;;;
@tonyg
tonyg / gap-buffer-annotations.rkt
Created November 17, 2017 14:41
Exploring approaches to managing a list of annotations parallel to a gap buffer.
#lang racket
;; Exploring approaches to managing a list of annotations parallel to
;; a gap buffer.
(struct annotations (front back total gap) #:prefab)
(define (annotations-seek anns pos0)
(match-define (annotations old-front old-back total old-gap) anns)
(define pos (max 0 (min total pos0)))
(cond
@tonyg
tonyg / dumpflags.rkt
Created November 17, 2017 13:46
Compile and run a small C program from Racket to determine values of system flags and enums
#lang racket
(define-logger dumpflags)
(define (delete-file/no-exn p)
(with-handlers [(exn:fail:filesystem? void)]
(delete-file p)))
(define (c-eval program-text #:quiet? [quiet? #f])
(define tmp.c (make-temporary-file "racket-c-eval-~a.c" #f))
@tonyg
tonyg / keybase.md
Created February 9, 2017 00:17
keybase.md

Keybase proof

I hereby claim:

  • I am tonyg on github.
  • I am leastfixedpoint (https://keybase.io/leastfixedpoint) on keybase.
  • I have a public key whose fingerprint is 630A 8781 4B1F A5BA C30F A95D 6141 87C4 CEB5 3E0C

To claim this, I am signing this object:

Chatterbase