Skip to content

Instantly share code, notes, and snippets.

View bennn's full-sized avatar

Ben Greenman bennn

View GitHub Profile
@bennn
bennn / roboTrain.frg
Created March 24, 2022 15:11
cs1710-roboTrain
#lang forge
option problem_type temporal
// ONLY CHANGE THE VALUE OF THE myFormula PREDICATE!
// There is a robotic train with three components: an engine, a door, and
// a headlight.
// At any point in time:
// - the Engine may be on or off
// - the Door may be on (open) or off (closed)
@bennn
bennn / chat.rkt
Created February 19, 2022 21:10
YouTube Live Stream Chat: Collect and Order Names
#lang racket
;; To open a chat window:
;; 1. Open a YouTube livestream
;; 2. Copy the ID part of the url (v=<ID>)
;; 3. Paste ID to the end of the link below
;; https://www.youtube.com/live_chat?v=
;;
;; Tutorial video: https://youtu.be/DjsbmnyXDIo
#lang forge
option problem_type temporal
// ONLY CHANGE THE VALUE OF THE myFormula PREDICATE!
// There is a control panel with lights on it. Each light has a
// different color, and over time some may be switched on or off.
abstract sig Color {}
one sig Red, Green, Blue extends Color {}
one sig Panel { var lit: set Color }
@bennn
bennn / line-count.rkt
Created August 1, 2020 16:22
quickscript: count lines in a file, even if unsaved or with unmatched parentheses
#lang racket/base
;; Count lines
;; Use the selection, if any, otherwise count lines across all definitions.
;;
;; Other ideas:
;; - if the file is read-able, use `syntax-sloc`
;; - find way to count types, contracts, etc.
(require quickscript
diff --git a/typed-racket-lib/typed-racket/base-env/base-env-indexing-abs.rkt b/typed-racket-lib/typed-racket/base-env/base-env-indexing-abs.rkt
index 366513da..68bd95de 100644
--- a/typed-racket-lib/typed-racket/base-env/base-env-indexing-abs.rkt
+++ b/typed-racket-lib/typed-racket/base-env/base-env-indexing-abs.rkt
@@ -3,12 +3,18 @@
(require
"../utils/utils.rkt"
(for-template racket/base racket/list racket/unsafe/ops racket/flonum racket/extflonum racket/fixnum)
+ (for-syntax racket/base syntax/parse)
(utils tc-utils)
#lang scribble/manual
@(require pict ppict/2)
@(define (textit str)
(text str '(italic) 12))
@(define (node sym)
(define p (textit (symbol->string sym)))
(define p+ (cc-superimpose (blank (+ 10 (pict-width p)) (+ 4 (pict-height p))) p))
@bennn
bennn / poem.scrbl
Last active July 16, 2019 15:18
Scribble poem
#lang scribble/manual
@; GOAL
@; Buffalo Bill’s
@; defunct
@; who used to
@; ride a watersmooth-silver
@; stallion
@; and break onetwothreefourfive pigeonsjustlikethat
@; Jesus
@bennn
bennn / main.scrbl
Created August 15, 2018 19:28
include/reader in a scribble file
#lang scribble/manual
@(require racket/include (for-syntax (prefix-in sr: scribble/reader)))
@(include/reader "text.txt" sr:read-syntax-inside)
version: 1.0.{build}
platform: x64
environment:
PATH: C:\Program Files\Racket;%PATH%
build_script:
- ps: >-
Invoke-WebRequest https://github.com/pauldalewilliams/chocolatey-comm-pkgs/raw/48c2d2110beae07ff38b3125ea57f03ab67ced20/racket/racket.6.10.nupkg -OutFile racket.6.10.nupkg
Invoke-WebRequest https://raw.githubusercontent.com/pauldalewilliams/chocolatey-comm-pkgs/48c2d2110beae07ff38b3125ea57f03ab67ced20/racket/racket.nuspec -OutFile racket.nuspec
#lang racket
(require file/glob pict racket/draw)
(define (path->pict path)
(bitmap (make-object bitmap% path 'png)))
(define p
(parameterize (#;[current-directory (build-path "Users" "ben" "Desktop")])
(apply vc-append 20 (map path->pict (glob "/Users/ben/Desktop/Screen*png")))))