Skip to content

Instantly share code, notes, and snippets.

View spdegabrielle's full-sized avatar

Stephen De Gabrielle spdegabrielle

View GitHub Profile
@alex-hhh
alex-hhh / data-types.md
Last active February 14, 2019 11:15
data types
@samdphillips
samdphillips / spotify.rkt
Created July 13, 2018 20:57
Remote control of Spotify from Racket for Mac OSX
#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.
|#
@alex-hhh
alex-hhh / current-value-fancy.rkt
Created March 20, 2018 06:13
Interactive overlays with the Racket Plot Package
#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))
@spdegabrielle
spdegabrielle / draw-partly-rounded-shape.rkt
Created November 29, 2017 18:40 — forked from tonyg/draw-partly-rounded-shape.rkt
Drawing partly-rounded-rectangles using Racket's path support
#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)
@dvanhorn
dvanhorn / tweet.rkt
Last active May 10, 2021 13:18
Tweet from Racket
#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
@deeglaze
deeglaze / standard-cat.rkt
Last active July 20, 2019 14:11
working out the definition of Racket's to-be standard-cat
#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))]
#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
@spdegabrielle
spdegabrielle / solar.rkt
Created May 23, 2017 20:27
solar sim using 2htdp/universe
#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

Install dlib and face_recognition on a Raspberry Pi

Instructions tested with a Raspberry Pi 2 with an 8GB memory card. Probably also works fine on a Raspberry Pi 3.

Steps

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.

How to install dlib v19.9 or newer (w/ python bindings) from github on macOS and Ubuntu

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: