Skip to content

Instantly share code, notes, and snippets.

View danlentz's full-sized avatar

Dan Lentz danlentz

View GitHub Profile
@danlentz
danlentz / overview.lisp
Created September 10, 2012 18:51 — forked from jaeschliman/overview.lisp
overview of the protocol, sequence, iterator, and iterate+ packages.
#|
A working overview of the protocol, sequence,
iterator, and iterate+ packages.
These packages are each quite small and are
intended to be used ala carte.
the projects are all here on github:
https://github.com/jaeschliman/
@danlentz
danlentz / actor.lisp
Created January 4, 2013 10:03 — forked from sile/actor.lisp
actor lib by quek
(in-package :actor)
(defparameter *current-process* (make-process :background nil))
(define-symbol-macro self *current-process*)
;; fork
(defun fork-impl (fn)
(let ((proc (make-process)))
(execute-fork-fn fn proc) ; forkしたプロセスを実行する
proc))
@danlentz
danlentz / restas-daemon.lisp
Created February 1, 2013 19:10 — forked from irmpow/restas-daemon.lisp
/etc/restas/
;;;; restas-daemon.lisp
;;;;
;;;; Usage:
;;;; sbcl --noinform --no-userinit --no-sysinit --load /path/to/restas-daemon.lisp /path/to/daemon.conf COMMAND
;;;; where COMMAND one of: start stop zap kill restart nodaemon
;;;;
;;;; If successful, the exit code is 0, otherwise 1
;;;;
;;;; Error messages look in /var/log/messages (usually, depend on syslog configuration)
;;;;
(deftype octet () '(unsigned-byte 8))
(defun read-le-uint (size in)
(loop FOR i FROM 0 BELOW size
SUM (ash (read-byte in) (* i 8))))
(defun read-bytes (size in)
(let ((ary (make-array size :element-type 'octet)))
(read-sequence ary in)
ary))
(defun lisp-reinsert-as-pp ()
"Read sexp at point, delete it and pretty print it back in."
(interactive)
(let* ((buf (current-buffer))
(pp-sexp
(replace-regexp-in-string
"\\(\n\\)$"
""
(with-temp-buffer
(let ((bufname (buffer-name)))
;;; THIS IS A PROOF OF CONCEPT. This has been "released" in case someone
;;; actually wants to develop it into a usable tool. Don't even think
;;; about using this version for any sort of production use.
;;; Author: Juho Snellman
;;; http://jsnell.iki.fi/blog/archive/2005-07-06.html
(defparameter *retain* (make-hash-table :test 'eq))
(defparameter *ignore* (make-hash-table :test 'eq))
(defparameter *classes* nil)
(ql:quickload 'babel)
(defbinstruct class-file
(magic 4) ;; values are bytes when types aren't specified
(minor-version 2)
(major-version 2)
(constant-pool (:struct constant-pool))
(access-flags 2)
(this-class 2)
(super-class 2)
@danlentz
danlentz / pr.md
Created March 26, 2013 06:23 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

(defmacro ->> (gen &rest forms)
"Clojure's ->> macro"
(reduce (lambda (g f)
(cond ((symbolp f) (list f g))
((consp f) `(,@f ,g))
(t (error "invalid form : ~S" f))))
forms :initial-value gen))
(defmacro $ (&rest xs)
"Gauche's $ macro (minimal ver.)"
;;; -*- lexical-binding: t -*-
(define-slime-contrib slime-documentation-search
"Hand off a documenation search to a web site."
(:authors "Ben Hyde <bhyde@pobox.com>")
(:license "GPL")
(:on-load
(define-key slime-doc-map "\C-s" 'slime-documention-search)
(define-key slime-doc-map "s" 'slime-documention-search)))