Moved here
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
#| | |
A Hack to remote control Spotify from Racket. | |
It pretty reliably will crash DrRacket if run. | |
Works better if require'd from another module, or run from command line. | |
|# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require racket/gui mrlib/snip-canvas plot pict racket/draw) | |
(define (pie-slice w h angle) | |
(define nangle (let ((npi (floor (/ angle (* 2 pi))))) | |
(- angle (* 2 pi npi)))) | |
(define (draw dc dx dy) (send dc draw-arc dx dy w h (- (/ nangle 2)) (/ nangle 2))) | |
(dc draw w h)) | |
(define item-font (send the-font-list find-or-create-font 12 'default 'normal 'normal)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang send-exp racket | |
(require racket/draw) | |
(define-syntax-rule (build-path (p) body ...) | |
(let ((p (new dc-path%))) | |
body ... | |
p)) | |
(define (quarter-circle p cx cy quarter radius) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(provide tweet! (struct-out oauth) current-oauth) | |
(require (only-in racket/random crypto-random-bytes) | |
json | |
net/url | |
(only-in net/uri-codec [uri-unreserved-encode %]) | |
web-server/stuffers/hmac-sha1 | |
(only-in net/base64 base64-encode)) | |
;; tweet! : String -> JSON |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require pict/color) | |
(provide | |
(contract-out | |
[cat-silhouette | |
(->i ([width positive?] [height positive?]) | |
(#:left-ear-extent [left-ear-extent (>=/c 0)] | |
#:left-ear-arc [left-ear-arc (real-in 0 (* 2 pi))] | |
#:left-ear-angle [left-ear-angle (real-in 0 (* 2 pi))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang scribble/doc | |
Okay, we've made a package and up loaded. But you know what would be lovely?. | |
Docs! This tutorial is going to start assuming you have a blank file and now clue where to start. By | |
the end we will have written the documentation for this line-of-best-fit library <show>. | |
This is racket land, so of course we have a language for documentation! #lang scribble/doc | |
@(require scribble/manual |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(require 2htdp/universe 2htdp/image lang/posn) | |
; The gravitational constant G | |
(define G 6.67428e-11) | |
; Assumed scale: 100 pixels = 1AU | |
(define AU (* 149.6e6 1000)) | |
(define SCALE (/ 250 AU)) | |
(struct body (id px py vx vy mass radius color) #:mutable #:transparent) ;Structure of body |
Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.
Download the latest Raspbian Jessie Light
image. Earlier versions of Raspbian won't work.
Write it to a memory card using Etcher, put the memory card in the RPi and boot it up.
Pre-reqs:
- Have Python 3 installed. On macOS, this could be installed from homebrew or even via standard Python 3.6 downloaded installer from https://www.python.org/download. On Linux, just use your package manager.
- On macOS:
- Install XCode from the Mac App Store (or install the XCode command line utils).
- Have homebrew installed
- On Linux: