Skip to content

Instantly share code, notes, and snippets.

@jbclements
jbclements / rhombus-logo-prototype.rhm
Created November 30, 2023 01:29
a first pass at a rhombus logo
#lang rhombus
import:
lib("2htdp/image.rkt") as img
lib("racket/base.rkt")
lib("lang/posn.rkt")
def make_color = img.#{make-color}
def empty_scene = img.#{empty-scene}
def posn = posn.#{make-posn}
@jbclements
jbclements / spf-fail.rkt
Created February 10, 2023 18:19 — forked from otherjoel/spf-fail.rkt
Generate a form email to explain to someone at another company that their SPF is broken
#lang racket/base
;; Generate a form email to let someone know their SPF records are misconfigured for their current email provider.
;;
;; Run (fill-report "domain.com" "1.2.3.4") where the 2nd arg is the sending email server's IP address.
;; It will copy the completed report to the clipboard for you.
;; Only works on Windows for now.
(require net/dns
#lang racket
;; filter the lines in "installer-data" as indicated in the release
;; checklist.
;; filter out lines that match a predicate, report on the remaining set
(define (filter-out description pred l)
(define new-l (filter (compose not pred) l))
(printf "discarding these ~v:\n" description)
#lang racket
(define last-str #f)
(struct node (l r))
(require rackunit)
(define (b-after-a? tree)
(match tree
#lang racket
(define last-str #f)
(define (b-after-a? tree)
(match tree
[(? string? s)
(cond [(and (equal? s "b")
(equal? last-str "a"))
#lang racket
(module sim-AQSE3.5 racket
(provide
(rename-out [lambda lam])
#%module-begin
#%app
#%datum
+ - * / >= <= > <
#lang racket
#;((define loop-maker
(λ (loop-maker)
(λ (n)
(if (< n 17)
((loop-maker loop-maker) (+ n 1))
n))))
#lang racket
;; this module defines the sim-AQSE3 language, which
;; simulates AQSE3, by providing
;; only a few key forms from Racket. Specifically: lambda,
;; function calls, if, constants, and a few arithmetic
;; operators.
(module sim-AQSE3 racket
(provide
(rename-out [lambda lam]
#lang typed/racket
(require typed/rackunit)
;; an S-expression is one of:
;; a number
;; a string
;; a boolean
;; a symbol, or
;; (list S-expression ...)
#lang typed/racket
(require typed/rackunit)
;; an S-expression is one of:
;; a number
;; a string
;; a boolean
;; a symbol, or
;; (list S-expression ...)