Skip to content

Instantly share code, notes, and snippets.

View JMC-design's full-sized avatar

Johannes Martinez Calzada JMC-design

View GitHub Profile
@burtonsamograd
burtonsamograd / save-lisp-tree-shake-and-die.lisp
Last active February 10, 2025 22:32
A quick and dirty tree shaker for SBCL, giving about a 40% reduction in dump size.
;; -*- mode: lisp -*-
;;
;; A quick and dirty tree shaker for SBCL. Basically, it destroys the
;; package system and does a gc before saving the lisp image. Gives
;; about a 40% reduction in image size on a basic hello world test.
;; Would like to hear how it works on larger projects.
;;
;; Original idea from: https://groups.google.com/d/msg/comp.lang.lisp/6zpZsWFFW18/WMy4PyA9B4kJ
;;
;; Burton Samograd
@shortsightedsid
shortsightedsid / cl-udpip.lisp
Created October 27, 2014 22:01
Short guide to UDP/IP Client/Server programming in Common Lisp using usockets
; Short guide to UDP/IP Client/Server programming in Common Lisp using usockets
;
; The main reason for this guide is because there are very few examples that
; explain how to get started with socket programming with Common Lisp that I
; could understand.
; After working on a short example on TCP, I found the
; need for a UDP tutorial. So, here goes.
; As usual, we will use quicklisp to load usocket.
@perusio
perusio / calendar.lisp
Last active October 27, 2025 14:26
Implementation in Common Lisp of the algorithms for calendrical calculations from the book ¨Calendrical Calculations" by Dershowitz and Rheingold, 3rd edition, Cambridge University Press, 2007.
;; The following Lisp code is from ``Calendrical
;; Calculations'' by Nachum Dershowitz and Edward
;; M. Reingold, Software---Practice & Experience, vol. 20,
;; no. 9 (September, 1990), pp. 899--928 and from
;; ``Calendrical Calculations, II: Three Historical
;; Calendars'' by Edward M. Reingold, Nachum Dershowitz,
;; and Stewart M. Clamen, Software---Practice & Experience,
;; vol. 23, no. 4 (April, 1993), pp. 383--404.
;; This code is in the public domain, but any use of it
@orivej
orivej / screenshot.lisp
Last active June 5, 2018 15:20 — forked from liftoff/xcb_screenshot.py
Take, save, and display a screenshot in Common Lisp (using CLX and ZPNG).
(defmacro with-display (host (display screen root-window) &body body)
`(let* ((,display (xlib:open-display ,host))
(,screen (first (xlib:display-roots ,display)))
(,root-window (xlib:screen-root ,screen)))
(unwind-protect (progn ,@body)
(xlib:close-display ,display))))
(defun take-screenshot (&optional (host ""))
(with-display host (display screen root-window)
(xlib:get-image root-window :x 0 :y 0 :width (xlib:screen-width screen) :height (xlib:screen-height screen))))