Skip to content

Instantly share code, notes, and snippets.

@danlei
danlei / newsgroups.lisp
Created January 2, 2010 06:19
newsgroups.lisp -- See the blog entry at tinyurl.com/ybct3cm. Runs on CCL.
(defpackage :newsgroups
(:use :common-lisp :cl-ppcre :pcall))
(in-package :newsgroups)
(defun distribution (items)
(loop with result = (make-hash-table :test #'equal)
for item in items
do (setf (gethash item result) (1+ (gethash item result 0)))
finally (return result)))
@danlei
danlei / loona.hs
Created March 18, 2010 21:21
loona.hs
----
---- loona.hs
----
---- Time-stamp: <2010-03-08 03:47:53 danlei>
----
module Loona
where
import Text.ParserCombinators.Parsec
@danlei
danlei / cl-init.lisp
Last active September 4, 2015 23:34
cl-init.lisp
;;;;; -*- common-lisp -*-
;;;;;
;;;;; cl-init.lisp
;;;;;
;;;;; CL initialization file. Works for CCL, Allegro, CLISP, and
;;;;; probably SBCL.
;;;;;
;;;;; Time-stamp: <2013-01-27 01:35:53 dhl>
;;;;;
@danlei
danlei / cl-xine.lisp
Created June 30, 2010 01:06
cl-xine.lisp
;;;;
;;;; cl-xine.lisp
;;;;
;;;; Time-stamp: <2008-11-09 11:23:11 danlei>
;;;;
(defpackage #:cl-xine
(:use #:common-lisp
#:cffi))
@danlei
danlei / gslist.c
Created July 1, 2010 21:19
gslist.c
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
// gcc -o gslist gslist.c `pkg-config --cflags --libs glib-2.0`
typedef struct {
char *name;
int size;
@danlei
danlei / t1.c
Created July 1, 2010 21:21
g_slist_foreach example
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
typedef struct {
char *name;
} Person;
void print_name(Person *pers) {
@danlei
danlei / ConstituentParser.hs
Created July 2, 2010 15:46
ConstituentParser
module ConstituentParser
where
import Text.ParserCombinators.Parsec
import Control.Monad
import Control.Applicative ((<$>))
symbol = oneOf "!#$%&|*+-/:<=>?@^_~"
@danlei
danlei / .Xresources
Created July 24, 2010 23:23
.Xresources
!!!!
!!!! .Xresources
!!!!
!!!! Time-stamp: <2010-07-25 01:22:58 danlei>
!!!!
!! xterm
XTerm*font:9x15
XTerm*background:black
XTerm*foreground:gray
(defvar mb-tab-width default-tab-width)
(defun mb-literal-tabs ()
(interactive)
(indent-tabs-mode 1)
(local-set-key (kbd "TAB") 'self-insert-command)
(setq tab-width mb-tab-width))
(add-hook 'html-mode-hook 'mb-literal-tabs)
@danlei
danlei / dhl-plink.el
Created September 11, 2010 22:05
dhl-plink.el