Skip to content

Instantly share code, notes, and snippets.

View kayomarz's full-sized avatar

Kayomarz kayomarz

  • Pune, India.
View GitHub Profile
@kayomarz
kayomarz / pathname-as-dir.lisp
Created September 12, 2023 06:23
pathname-as-dir - return a `pathname` directory
;; `(pathname "/foo/bar")` uses the trailing directory separator to decide if a
;; path refers to a file or directory
;; (pathname "/home/foo.bar" ) => #P"/home/foo.bar"
;; (pathname "/home/foo.bar/") => #P"/home/foo.bar/"
;; Instead, this function definition `pathname-as-dir` results in a pathname
;; which is a always a directory irrespective of the trailing slash contained in
;; the string argument.
@kayomarz
kayomarz / gist:65e0d124f008b222ddf317e9f920c37f
Created August 14, 2023 03:57
Uninstall / Remove all software installed via quicklisp
;;; Start lisp, for example run sbcl.
;;; $ sbcl
;;; First uninstall all systems.
;;; ref: https://github.com/quicklisp/quicklisp-client/issues/147#issuecomment-1631778086
(mapc #'ql:uninstall (mapcar #'ql-dist:short-description (ql-dist:installed-systems t)))
;;; To be able to use slime, we install the slime helper
(ql:quickload "quicklisp-slime-helper")
@kayomarz
kayomarz / ray-triangle-intersect.lisp
Created June 22, 2023 03:26
A Common Lisp port of the Möller–Trumbore ray-triangle intersection algorithm originally authored in C.
;;; A Common Lisp port of the Möller–Trumbore ray-triangle intersection
;;; algorithm originally authored in C.
;;; Introduction
;;; ============
;;; The Möller–Trumbore ray-triangle intersection algorithm is credited to its
;;; inventors Tomas Möller and Ben Trumbore.
;;; The original C code was accessed from Möller Trumbore's article: `Practical