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
*.so | |
*.o | |
*.html | |
.*.un~ | |
.*.swp |
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-modules (system base lalr)) | |
(define csv-parse | |
(lalr-parser | |
(CELL COMMA NEWLINE RETURN) | |
(csv () : '() | |
(csv row) : (cons $2 $1)) | |
(row (nl) : (list "") | |
(COMMA row) : (cons "" $2) | |
(CELL nl) : (list $1) | |
(CELL COMMA row) : (cons $1 $3)) |
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-modules (oop goops) (aiscm element) (aiscm int) (aiscm sequence) (aiscm op) (srfi srfi-26)) | |
(define s (to-type (list->multiarray '(2 3 5 7)) <int>)) | |
(make (to-type (class-of s) <byte>) #:shape (shape s) #:value (get-value s) #:strides (map (cut * 4 <>) (strides s))) |
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 | |
def task n | |
result = 0 | |
for i in 1 ... n | |
result += i | |
sleep 0.01 | |
end | |
result | |
end | |
t = Thread.new 100, &method(:task) |
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 | |
require 'hornetseye_rmagick' | |
require 'hornetseye_xorg' | |
include Hornetseye | |
img = MultiArray.load_ubyte 'http://www.shu.ac.uk/research/meri/sites/shu.ac.uk/files/Fabio2%20case%20study.jpg' | |
sparks = (img >= 200).to_ubyte.sum | |
puts "about #{sparks} sparkly pixels" | |
puts "your milling tool is toast" if sparks >= 200 |
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
require 'multiarray' | |
require 'hornetseye_opencv' | |
require 'hornetseye_rmagick' | |
require 'hornetseye_narray' | |
include Hornetseye | |
img = MultiArray[[2, 3, 5, 7], [11, 13, 17, 19]] | |
# MultiArray(UBYTE,2): | |
# [ [ 2, 3, 5, 7 ], | |
# [ 11, 13, 17, 19 ] ] | |
cvmat = img.to_cvmat |
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-modules (srfi srfi-1) (srfi srfi-26) (ice-9 curried-definitions)) | |
(define (dot graph colors) | |
(apply string-append | |
(append (list "graph g {") | |
(map (lambda (color) (format #f " ~a [style=filled, fillcolor=~a];" (car color) (cdr color))) colors) | |
(map (lambda (edge) (format #f " ~a -- ~a;" (car edge) (cdr edge))) graph) | |
(list " }")))) | |
(define (graphviz graph colors) (system (format #f "echo '~a' | dot -Tpng | display -" (dot graph colors)))) | |
(define (nodes graph) (delete-duplicates (append (map car graph) (map cdr graph)))) | |
(define ((has-node? node) edge) (or (eq? (car edge) node) (eq? (cdr edge) node))) |
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
# sudo docker build -t wedesoft/aiscm | |
# sudo docker run --rm -t -i wedesoft/aiscm /bin/bash | |
# sudo docker run --rm -p 80:80 wedesoft/aiscm | |
FROM debian:jessie | |
MAINTAINER Jan Wedekind <jan@wedesoft.de> | |
ENV ARTANIS_VERSION 0.1.2.1-be890-dirty | |
ENV SERVER_HOME /srv/artanis-repl | |
RUN apt-get update && \ |
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-modules (artanis artanis) (artanis cookie) (artanis utils)) | |
(init-server) | |
(get "/" #:session 'spawn | |
(lambda (rc) | |
(let [(sid (or (cookie-ref (rc-cookie rc) "sid") (:session rc 'spawn))) | |
(time (strftime "%c" (localtime (current-time))))] | |
(tpl->response `(html (body (p ,sid) (p ,time))))))) | |
(run) |