Skip to content

Instantly share code, notes, and snippets.

@endobson
Created August 20, 2016 05:01
Show Gist options
  • Select an option

  • Save endobson/3c98c71575f3fc937644b98dcfc7e2a7 to your computer and use it in GitHub Desktop.

Select an option

Save endobson/3c98c71575f3fc937644b98dcfc7e2a7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env racket
#lang racket/base
(require
file/convertible
net/base64
plot/no-gui
)
(define (write-image img port)
(write-bytes #"\x1b]1337;File=inline=1:" port)
(write-bytes (base64-encode (convert img 'png-bytes) #"") port)
(write-bytes #"\x07\n" port)
(void))
(define cool-plot
(plot3d-pict (vector-field3d (λ (x y z) (vector x z y)) -2 2 -2 2 -2 2)))
(write-image cool-plot (current-output-port))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment