Skip to content

Instantly share code, notes, and snippets.

@signalpillar
Last active August 29, 2015 13:56
Show Gist options
  • Save signalpillar/9107761 to your computer and use it in GitHub Desktop.
Save signalpillar/9107761 to your computer and use it in GitHub Desktop.
hy on cherrypy
; standard imports
(import random)
; 3rd-party imports
(import [cherrypy [config quickstart expose]])
(def choices [
[
"initializing" "indexing" "configuring"
"particulating' 'prioritizing"
"preparing" "iterating" "modeling"
"generating" "gathering" "computing"
"building" "resolving" "adjusting"
"re-ordering" "sorting" "allocating"
"multiplexing" "scheduling" "routing"
"parsing" "pairing" "partitioning"
"refactoring" "factoring" "freeing"
"repositioning" "reducing" "setting"
"sampling" "memoizing" "dispatching"]
[
"b-tree" "directory" "hash"
"random-order" "compute" "lookup"
"in-order" "inverse" "root"
"first-order" "threaded"
"priority" "bit" "circular"
"bi-directional" "multi-dimensional"
"decision" "module" "dynamic"
"associative" "linked" "acyclic"
"radix" "binomial" "binary" "parallel"
"sparse" "cartesian" "redundant"
"duplicate" "unique" "storage dump"]
[
"structures" "tree" "datasets"
"stores" "jobs" "functions"
"callbacks" "matrices" "arrays"
"tables" "queues" "fields" "stack"
"heaps" "segments" "map structures"
"graph structures" "namespaces"
"procedures" "processes" "lists"
"sectors" "stackframes" "receptacles"
"composition"]
])
(defn random_busywait [ &rest choices ]
(let [[words (map (fn [c] (.choice random c)) choices)]]
(.join " " words)))
; (.join " " (map (fn [c] (.choice random c)) choices))
;;; web-server part
(defclass BusyWait [object]
[[index
(with-decorator expose (fn [self]
(apply random_busywait choices)))]
])
(.update config {
"server.socket_port" 8888
})
(when (= __name__ "__main__")
(quickstart (BusyWait)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment