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
;;;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) |
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
;;;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 |
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
;;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) |
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
;;cl-opengl, load toon shader | |
(require :asdf) | |
(asdf:load-system :cl-opengl) | |
(asdf:load-system :cl-glu) | |
(asdf:load-system :cl-glut) | |
(defun file->string (path) | |
"Sucks up an entire file from PATH into a freshly-allocated string, | |
returning two values: the string and the number of bytes read." | |
(with-open-file (s path) |
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
<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 |
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
;;add to your .emacs | |
(defun git-commit-file-and-push (&optional commit-msg) | |
"Commit current file and push to git repository." | |
(interactive) | |
(if (null commit-msg) | |
(setq commit-msg (read-from-minibuffer "Commit message: "))) | |
(if (buffer-modified-p (current-buffer)) | |
(if (y-or-n-p "Save modified buffer? ") | |
(save-buffer))) |
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
mplayer -af volume=20:0 mediafile |
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
/** 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*); |
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
#include "camshifting.h" | |
/* Create a camshift tracked object from a region in image. */ | |
TrackedObj* create_tracked_object (IplImage* image, CvRect* region) { | |
TrackedObj* obj; | |
//allocate memory for tracked object struct | |
if((obj = malloc(sizeof *obj)) != NULL) { | |
//create-image: size(w,h), bit depth, channels | |
obj->hsv = cvCreateImage(cvGetSize(image), 8, 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
#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' |
OlderNewer