Skip to content

Instantly share code, notes, and snippets.

View danking's full-sized avatar

Dan King danking

View GitHub Profile
#lang racket
(require ffi/unsafe
ffi/unsafe/custodian)
(define n 0)
(define (foo)
(define 100bytes (malloc 100 'raw))
(define uid n)
(set! n (add1 n))
@danking
danking / gist:9608764
Created March 17, 2014 21:28
My test program.
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/mman.h>
#include <sys/namei.h>
#include <sys/ucred.h>
#include <sys/queue.h>
#include <sys/vnode.h>
#lang racket
(require parser-tools/lex)
(require parser-tools/yacc)
(require (prefix-in : parser-tools/lex-sre))
(provide parse-program current-source-name)
(define current-source-name (make-parameter #f))
#lang typed/racket
(: mergesort : (All (X) ([Listof X] [X X -> Boolean] -> [Listof X])))
(define (mergesort ls <=)
(: mergesort/length : (All (X) ([Listof X] Integer -> [Listof X])))
(define (mergesort/length ls n)
(let* ([n/2 (exact-floor (/ n 2))])
(cond [(= n 0) ls]
[(= n 1) ls]
[else (merge (mergesort/length (take ls n/2) n/2)
(define-syntax (val stx)
(syntax-case stx ()
[(_ id v)
#`(define-syntax id
(make-set!-transformer
(lambda (stx)
(syntax-case stx (set!)
[(set! id new-v) #'(error 'id "~a is not mutable" (symbol->string 'id))]
[id (identifier? #'id) #'v]))))]))
[danking@shillbsd /usr/home/danking/projects/shill/tests]$ bash runtests.sh
0001.sh: cat a file
fail: Operation not supported
shill_grant failed
FAILED
0002.sh: move a file
fail: Operation not supported
shill_grant failed
diff: tmp/bar.txt: No such file or directory
FAILED
[danking@shillbsd /usr/home/danking]$ dmesg | grep shill
danking@shillbsd:/usr/obj/usr/src/sys/GENERIC amd64
Security policy loaded: Shill Sandbox Module (shill)
[danking@shillbsd /usr/home/danking]$
///////////////////////////////////////////////////////////////////////////////
// data
function throw2 (arg) {
throw arg;
}
function numberDatum() { }
function makeDefaultNumber() {
#lang racket
(require rackunit
(rename-in racket [#%app old-app]))
(define-syntax #%app
(syntax-rules (?)
([#%app condition ? then else]
(if condition then else))
([#%app x ...]
@danking
danking / ndseg.org
Last active December 31, 2015 18:49
NDSEG Application

Leadership

Organizing Racket Salon

I organize the Racket Salon Boston meet-ups for enthusiasts of the Racket programming language. I maintain a website, generate interest via email lists, recruit and coordinate speakers, and arrange meeting spaces at local Universities.

Matthias Felleisen [email protected]

Volunteer Work