Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# PROVIDE: www
# REQUIRE: LOGIN FILESYSTEMS
# KEYWORD: shutdown
. /etc/rc.subr
name="www"
rcvar="${name}_enable"
@lamberta
lamberta / demo-cffi.lisp
Created October 18, 2009 02:53
use C shared lib with cffi
;;;building a C shared library,
;;;and calling it in Common Lisp with CFFI
(require :asdf)
(asdf:load-system :cffi)
(defpackage :cffi-user
(:use :common-lisp :cffi))
(in-package :cffi-user)
@lamberta
lamberta / gist:212583
Created October 18, 2009 06:58
save sbcl core as an executable
;;;save sbcl core as an executable
;;;http://www.sbcl.org/manual/Saving-a-Core-Image.html
(sb-ext:save-lisp-and-die "myexec" ;file name
:executable t ;create a standalone executable
:toplevel 'main ;function to run when core is resumed
:purify t) ;purifying gc to move dynamic objs to static space
@lamberta
lamberta / gist:217730
Created October 24, 2009 20:42
vecto example - draw text, circle, line
;;vecto example
;;draw text, circle, and some lines
(require :asdf)
(asdf:load-system :vecto)
(defparameter *font* "/home/billy/.fonts/Consola.ttf")
(defun draw-it (file)
(vecto:with-canvas (:width 200 :height 200)
@lamberta
lamberta / 01-hello-shapes.html
Created October 25, 2009 16:13
Intro to Canvas - BuffaloLab demo
<html>
<head>
<script type="text/javascript">
function draw () {
var canvas = document.getElementById("my_canvas");
var ctx = canvas.getContext("2d");
rect(ctx);
triangle(ctx); //on square
circle(ctx); //on tri
@lamberta
lamberta / gist:223133
Created October 31, 2009 16:14
mplayer audio boost
mplayer -af volume=20:0 mediafile
@lamberta
lamberta / facedetect.c
Created November 10, 2009 02:23
basic OpenCV face detection
/** Basic OpenCV example for face detecion.
* Handles a still image or a video file.
**/
#include <stdio.h>
#include <cv.h>
#include <highgui.h>
void detect_faces (IplImage*, CvHaarClassifierCascade*, CvMemStorage*);
void cleanup (char*, CvHaarClassifierCascade*, CvMemStorage*);
void print_help (char*);
#grep through files,
#search list titles which start with ':'
#replace colons with tabs
#return file name, line number, title
grep -n -e '^:.*text' ./* | sed 's/:\+/\t/g'
@lamberta
lamberta / RemoteTCP.py
Created April 16, 2010 02:16
RemoteTCP - FontLab server
#===============================================================================
# RemoteTCP.py, v0.1, released 01.26.08.
# Installation notes, usage and commentary:
# http://lamberta.posterous.com/remotetcp-for-robofab-and-fontlab
#
# Copyright (c) William Lamberta, <www.lamberta.org>
# Released under the BSD License,
# see www.opensource.org/licenses/bsd-license.php for details.
# Includes code from RoboFab <www.robofab.org>,
# Copyright (c) The RoboFab Developers, Just van Rossum, Tal Leming, Erik van Bloklandwhich.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" width="450" height="400"
backgroundGradientAlphas="[0.93, 0.69]"
backgroundGradientColors="[#FFFFFF, #DFDDDD]"
applicationComplete="initApp();">
<mx:Script>
<![CDATA[
//pv3d