This file contains 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
#!/usr/bin/env ruby | |
# Install capybara and selenium-webdriver gems | |
# | |
# $ gem install capybara | |
# $ gem install selenium-webdriver | |
# | |
# Install chromedriver | |
# | |
# $ brew install chromedriver |
This file contains 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 data/heap) | |
(define input (for/list ([ _ (in-range 115000) ]) | |
(random-string 15))) | |
(define (with-heap) | |
(define obj (make-heap string<?)) |
This file contains 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
7244905526470311611337745375360647070103318145091810475294443959205903269815432029594266166723714185361138590835216693116208284679621696954033110897534800579429466521604082415532604287932045158162595824996655193676123122999642590109125116750054446144751351034094448535449050903231651086011168322066940336519305828743362259968158287856254981663117325393100679512353241286969905855684823261263305491718845440574984949592731952014645531263799099412333314776225548860610909379015530065459784664128374526292482670023239647557311841929543464352496177741523126620505898932947212196942581407512794597968799736935372536952616345876007832357627296669040359534663242523772141528718782098843153045516344571543143156760034110345688765042977365823498261667173251989351238946743053267202809640911598773285954403972192887232987869919567325418630090367135402964516465269305495519916090051933005528194145375207978612602038720995965117226971322190235621924803801171071252432305251020009793057875025779634359577567241061391347408911384623302037 |
This file contains 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 file/sha1 | |
racket/list | |
racket/random) | |
(define N 1000000) | |
(define symbol-length 5) | |
(define (random-string n) |
This file contains 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
(define (application-controller connection request) | |
(output-response/method | |
connection | |
(response | |
200 | |
#"OK" | |
(current-seconds) | |
TEXT/HTML-MIME-TYPE | |
empty | |
(λ (op) (write-bytes #"<html><body>Hello, World!</body></html>" op))) |
This file contains 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
(define (application-controller connection request) | |
(response | |
200 | |
#"OK" | |
(current-seconds) | |
TEXT/HTML-MIME-TYPE | |
empty | |
(λ (op) (write-bytes #"<html><body>Hello, World!</body></html>" op)))) | |
(serve |
This file contains 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 main) | |
; Represent a position as a struct with x (file) and y (rank) members | |
(struct pos (x y) #:prefab) | |
; Indicate whether q1 is attacking q2 | |
(define (is-attacking? q1 q2) | |
(let ([q1x (pos-x q1)] [q1y (pos-y q1)] [q2x (pos-x q2)] [q2y (pos-y q2)]) |
This file contains 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 main) | |
; Represent a position as a struct with x (file) and y (rank) members | |
(struct pos (x y) #:prefab) | |
; Indicate whether q1 is attacking q2 | |
(define (is-attacking? q1 q2) | |
(let ([q1x (pos-x q1)] [q1y (pos-y q1)] [q2x (pos-x q2)] [q2y (pos-y q2)]) |
This file contains 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
use std::sync::{Mutex, Arc}; | |
use std::thread; | |
struct Philosopher { | |
name: String, | |
left: usize, | |
right: usize, | |
} | |
impl Philosopher { |
This file contains 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 | |
(define (memoize proc) | |
(define memo '()) | |
(λ (x) | |
(cond [(assq x memo) => cdr] | |
[else (let ([result (proc x)]) | |
(set! memo (cons (cons x result) memo)) | |
result)]))) |
NewerOlder