- Clack (Wookie handler)
- Wookie
- Node.js (http module)
- Mac OS X Mavericks (CPU: 3GHz Intel Core i7, Memory: 8GB)
- httperf v0.9.0
package main | |
import ( | |
"fmt" | |
"log" | |
"net/http" | |
) | |
func hello(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintf(w, "Hello, World") |
(cffi:define-foreign-library libevent2-pthreads | |
(:darwin (:or | |
"libevent_pthreads.dylib" | |
; brew's install of libevent on Mac OX X | |
"/usr/local/lib/libevent_pthreads.dylib" | |
; macports | |
"/opt/local/lib/libevent_pthreads.dylib")) | |
(:unix (:or "/usr/local/lib/event2/libevent_pthreads.so" | |
"libevent_pthreads.so" | |
"libevent_pthreads-2.0.so.5" |
;; http://kinokoru.jp/archives/840 | |
(defmacro css (name elems) | |
`(with-open-file | |
(*standard-output* ,(string-downcase name) :direction :output :if-exists :supersede) | |
,@(loop for (elem attrs) in elems | |
collect | |
`(format t "~a {~%" ,elem) | |
append | |
(mapcar (lambda (attr) |
#| | |
Twitpic Downloader | |
================== | |
This Common Lisp script downloads all image/video files from Twitpic account to the current directory. | |
## Usage | |
;; SBCL |
(defmacro execution-time (&body body) | |
"Return the number of milliseconds it takes to execute `body`. Also | |
returns the result as the second value." | |
(let ((tm (gensym)) | |
(res (gensym))) | |
`(let* ((,tm (get-internal-real-time)) | |
(,res (progn ,@body)) | |
(,tm (floor (* 1000 (- (get-internal-real-time) ,tm)) | |
internal-time-units-per-second))) | |
(values (float ,tm) ,res)))) |
#!/usr/bin/env sbcl --script | |
;; -*- mode: common-lisp -*- | |
;; Usage: | |
;; clhs [SYMBOL] | |
(require 'asdf) | |
(defparameter *hyperspec-home* | |
(merge-pathnames "Dropbox/Documents/HyperSpec/" (user-homedir-pathname)) |
;; Macros in this file provides a "autoload" facility like Emacs Lisp has. | |
;; These are supposed to be used in a Lisp init file. | |
;; | |
;; Without those, you have to load all libraries you not sure whether they will be used or not. | |
;; | |
;; (ql:quickload :repl-utilities) | |
;; (use-package :repl-utilities) | |
;; | |
;; "Autoload" facility delays loading libraries until they are needed. | |
;; See the following 3 macros and their documentations. |
;; This is a answer for a question of CodeIQ. | |
;; https://codeiq.jp/ace/cielavenir/q431 | |
(in-package :cl-user) | |
(defmacro print-capitalized (symbol &rest symbols) | |
`(progn | |
(princ ,(string-capitalize symbol)) | |
,@(loop for s in symbols | |
collect `(princ ,(name-char 'space)) |
(ql:quickload '(chipz archive)) | |
(defun extract-tarball (pathname) | |
"Extract a tarball (.tar.gz) file to a directory (*default-pathname-defaults*)." | |
(with-open-file (tarball-stream pathname | |
:direction :input | |
:element-type '(unsigned-byte 8)) | |
(archive::extract-files-from-archive | |
(archive:open-archive 'archive:tar-archive | |
(chipz:make-decompressing-stream 'chipz:gzip tarball-stream) |