Skip to content

Instantly share code, notes, and snippets.

View Metaxal's full-sized avatar

Laurent Orseau Metaxal

  • Google DeepMind
  • London, UK
View GitHub Profile
@Metaxal
Metaxal / mandelbrot-futures.rkt
Created July 18, 2022 17:14
Mandelbrot with futures, one future per processor
#lang racket/base
(require racket/future
racket/flonum)
;;; Author: Laurent Orseau https://github.com/Metaxal
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;; [MIT license](http://opensource.org/licenses/MIT) at your option.
;;;
;;; Based on the docs for racket/future,
;;; with one future per cpu
@Metaxal
Metaxal / fmt-quickscript.rkt
Last active August 19, 2022 09:49
Quickscript for sorawee's `fmt`
#lang racket/base
(require quickscript
fmt ; needs to be installed first
racket/class)
;;; Author: Laurent Orseau
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;; [MIT license](http://opensource.org/licenses/MIT) at your option.
(script-help-string "Format the selection or the whole program using `fmt`")
@Metaxal
Metaxal / server-worker-threads.rkt
Last active March 18, 2022 12:35
read issue on server-worker
#lang racket
#|
Save this file to "server-worker.rkt"
then run
$ time racket server-worker.rkt
Then toggle the commented expression in `read-msg` and again
$ time racket server-worker.rkt
@Metaxal
Metaxal / readme.md
Last active July 1, 2023 12:50
Making a pull request for a main distribution package for Racket
@Metaxal
Metaxal / andmap-stress-test.rkt
Last active December 16, 2021 12:34
andmap stress test
#lang racket
;; Allows for improper lists
(define (my-andmap proc l1 l2)
(let loop ([l1 l1] [l2 l2])
(cond [(and (null? l1) (null? l2)) #t]
[(or (null? l1) (null? l2))
(error "Lists must have the same length" (length l1) (length l2))]
[(and (pair? l1) (pair? l2))
(and (proc (car l1) (car l2))
@Metaxal
Metaxal / select-or-send-sexp.rkt
Last active February 17, 2022 12:59
Send the current s-expression to the interactions window (quickscript)
#lang racket/base
(require quickscript
racket/list
racket/class
framework
racket/gui/base)
;;; Author: Laurent Orseau https://github.com/Metaxal
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
@Metaxal
Metaxal / commonmark-render.rkt
Created November 23, 2021 23:17
Renders the current markdown file as HTML in the browser (quickscript)
#lang racket/base
;;; Author: Laurent Orseau https://github.com/Metaxal
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;; [MIT license](http://opensource.org/licenses/MIT) at your option.
;;; Requires `commonmark`
(require quickscript
commonmark
@Metaxal
Metaxal / plot-ticks.rkt
Created November 5, 2021 10:48
Customizing plot ticks
#lang racket
(require plot)
(define (tlayout low high)
(list
; major ticks: tick is shown with label
(pre-tick pi #t)
(pre-tick (sqrt 2) #t)
(pre-tick 0.5 #t)
; minor ticks: tick is shown, but without label
@Metaxal
Metaxal / command-palette.rkt
Last active March 19, 2023 22:14
`Navigate' the menus with a search-list-box (quickscript)
#lang racket/base
(require quickscript
racket/gui/base
racket/class
racket/list
search-list-box)
(provide (except-out (all-defined-out)
search-list-box-filter))
@Metaxal
Metaxal / debug-tool.rkt
Last active October 28, 2021 19:32
Map quickscript menus and keyboard shortcut to the Debug tool
#lang racket/base
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;; [MIT license](http://opensource.org/licenses/MIT) at your option.
(require quickscript
racket/string
racket/list
racket/class)