Skip to content

Instantly share code, notes, and snippets.

Avatar

Tony Garnock-Jones tonyg

View GitHub Profile
View gh-gists
#!/usr/bin/python
import sys
import gh
import os
import json
if len(sys.argv) > 1:
username = sys.argv[1]
else:
raise Exception('Expected github username as first command-line argument')
View csexp.py
# Simple Canonical S-Expression codec.
# https://people.csail.mit.edu/rivest/Sexp.txt
# Apache v2 Licenced. Copyright 2018-2019 Tony Garnock-Jones
import base64
import zlib
try:
unicode
except NameError:
View enforced-state-machine.rkt
#lang racket
;; Use Racket 7.3 or later; in particular, 7.0.0.7 seems to have a bug
;; where call-with-immediate-continuation-mark seems to dig past the
;; first continuation frame when it isn't supposed to.
(module+ test (require rackunit))
(module state-machine racket
(provide state-machine
state-lambda
@tonyg
tonyg / partial-reads.rkt
Last active May 22, 2019
Exploration of `replace-evt` in the context of getting a reliable signal that a complete frame of input is available.
View partial-reads.rkt
#lang racket
;; Exploration of `replace-evt` in the context of getting a reliable
;; signal that a complete frame of input is available.
(module+ test (require rackunit))
;; Imagine a protocol, based on a TCP socket, where every two adjacent
;; bytes sent by the server are to be treated together. That is,
;; fixed-size two-byte framing.
View gl-2d-clock-face.rkt
#lang imperative-syndicate
;; Compare to "ezd" clock-face example from: J. F. Bartlett, “Don’t
;; Fidget with Widgets, Draw!,” Palo Alto, California, DEC WRL
;; Research Report 91/6, May 1991.
(require lang/posn)
(require 2htdp/image)
(require (only-in racket/math pi))
(require racket/date)
View pico-muon.rkt
#lang racket/base
;; TODO: classifiers and views
(require racket/match)
(require racket/stxparam)
(require (for-syntax racket/base))
(define-syntax-parameter self
(lambda (stx)
View d.py
import sys
import datetime
import preserves
import queue
import asyncio
import random
from preserves import Record, Symbol
Assert = Record.makeConstructor('Assert', 'endpointName assertion')
Clear = Record.makeConstructor('Clear', 'endpointName')
@tonyg
tonyg / inotifytest
Created Nov 7, 2018
Simple inotify-based watcher/rebuilder - e.g. 'inotifytest make foo' or 'inotifytest redo'
View inotifytest
#!/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
View schema.diff
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');
View signify.rkt
#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
You can’t perform that action at this time.