Skip to content

Instantly share code, notes, and snippets.

@Lovesan
Lovesan / excel-interop.lisp
Created February 22, 2024 21:45
Excel interop using bike library
(eval-when (:compile-toplevel :load-toplevel :execute)
(unless (find-package 'bike)
(ql:quickload 'bike)))
(named-readtables:in-readtable bike:bike-syntax)
(bike:use-namespace 'System)
;; The below is required to overcome internal bike optimizations related to property retrieval,
;; which utilize Type.GetProperty internally, which does not work for COM objects.
;; Note that you should also use bike:reflection-invoke instead of invoke, for the same reasons.

sb-simd: Multiplying a 4x4 matrix with a 4-length vector (AVX)

(require 'sb-simd)
(defpackage :simd-pack-user
  (:use :sb-simd-avx :cl))
(in-package :simd-pack-user)

I'm assuming you are referring to the following operation:

@ivan4th
ivan4th / 1password.lisp
Created June 24, 2022 23:37
Inecobank scraping
(in-package :yobabank)
(defparameter *1pw-secure-note-name* "Yobabank Data")
(defparameter *1pw-vault* "Personal")
(defun 1pw-get-field (object name)
(when (typep object 'st-json:jso)
(st-json:getjso name object)))
(defun 1pw-get-id (object)
@ArooBaito
ArooBaito / webhook.scm
Last active August 7, 2021 20:35
Minimal Discord http-post requests from various Scheme implementations
;; Documentation on http post requests is a lot of guess-work in certain Scheme implementations.
;; To save some frustration, here is a compilation of examples on how to get a Discord
;; webhook bot to say a simple message from the various Schemes using default libraries
;; To the right is also the command to connect Emacs using inferior Scheme
;; BiwaScheme [browser] (setq scheme-program-name "shamisen-emacs") [see biwa-shamisen]
(http-post "https://discord.com/api/webhooks/[your info here]"
'(("content" . "Hello from BiwaScheme!")))
;; BiwaScheme [node] [not implemented] (setq scheme-program-name "biwas")
@Bike
Bike / dcont.lisp
Last active July 30, 2022 16:39
delimited continuation macro transformer
(defpackage #:delimited-continuations
(:use #:cl)
(:export #:with/dc #:reset #:shift))
(in-package #:delimited-continuations)
(defmacro letcont ((&whole binding name lambda-list &body cbody) &body body)
(let ((old (gensym "OLD")))
(multiple-value-bind (cforms cdecls)
(alexandria:parse-body cbody :whole binding)
@christophejunke
christophejunke / events.lisp
Last active June 26, 2021 19:42
Event loop with ncurse
(ql:quickload '(:iolib :cl-charms))
(defpackage :tui (:use :cl :cl-charms :iomux))
(in-package :tui)
;;; From http://turtleware.eu/posts/cl-charms-crash-course.html
(defun start-color ()
(when (eql (charms/ll:has-colors) charms/ll:FALSE)
(error "Your terminal does not support color."))
(let ((ret-code (charms/ll:start-color)))
(defpackage :LISP-1.5-compiler
(:use :Common-Lisp)
(:shadow :length ; defined by the compiler
:reverse ; defined by the compiler
:member ; defined by the compiler
:map ; like mapl, and function is first argument
:exp ; used as special variable in the compiler
:compile ; defined by the compiler
:maplist ; takes function first
:mapcon ; takes function first

Guix on WSL2

(updated versions of this document, plus more, live here)

This will show you how to get Guix running on WSL2.
We're going to go as "minimal" as possible, without starting off one of the readily available WSL2 distros.
Parts of this guide should help with understanding how to set up any custom distro on WSL, not just Guix.

Disclaimer: I'm a Guix nOOb! (hence going through the trouble of installing it on WSL2)

@belmarca
belmarca / cb.ss
Created April 26, 2020 01:05
Hooking gambit's ##wr.
;; cb.ss
(defstruct ugly-struct (a b c))
(defstruct wonderful-struct (a b c))
(defmethod {:wr wonderful-struct}
(lambda (self we obj)
(with ((wonderful-struct a b c) self)
(##wr-str we "🦄<")
(##wr-str we " 🌈🌈🌈 ")
(##wr-str we (string-append
@mfikes
mfikes / ESP32-REPL.md
Last active July 6, 2022 22:32
ClojureScript REPL into ESP32

To set up a REPL that has cljs.core available, we need to re-partition the ESP32 and allocate more memory in Espruino for "JsVars".

The default Espruino bootloader.bin, pre-built variants of partitions_esprinuo.bin and rebuilt espruino_esp32.bin, and the ClojureScript runtime core.bin are also available here.

bootloader.bin gets flashed to 0x1000, partitions_espruino.bin gets flashed to 0x8000, and espruino_esp32.bin gets flashed to 0x10000 as per a usual ESP32 Espruino setup, and we put the ClojureScript runtime at 0x2C0000: