Skip to content

Instantly share code, notes, and snippets.

View svetlyak40wt's full-sized avatar
💭
Making Ultralisp.org

Alexander Artemenko svetlyak40wt

💭
Making Ultralisp.org
View GitHub Profile
@svetlyak40wt
svetlyak40wt / replies.md
Last active July 16, 2023 22:25
Some advices about Common Lisp in reply to the https://www.youtube.com/watch?v=jLkqYVTqM38&lc=UgxECAkwcplTdFWvwit4AaABAg comment

...saw all your videos until this day. Thanks so much, cleared up alot of questions! Best tutorials out there for getting a overview on workflows! Still struggling with a couple of things

  1. QLOT vs (push "./" asdf:central-registry) workflow often you (push "./" asdf:central-registry) in the repl. Here you use qlot and it does that automatically as I understand Then you start $qlot exec ros emacs

So my questions are

  • what is the right flow or do I need both often ?
(defun save-me (core-file)
"This function closes all threads and dumps image of SBCL into the core file."
(flet ((saver ()
(loop for thread in (sb-thread:list-all-threads)
unless (eql thread
sb-thread:*current-thread*)
do (sb-thread:terminate-thread thread)
finally (save-lisp-and-die core-file))))
(loop for thread in (sb-thread:list-all-threads)
when (string-equal (sb-thread:thread-name thread)
@svetlyak40wt
svetlyak40wt / README.md
Created June 16, 2023 15:19
A small test checking Tungsten Postgres Driver in fetching random records from WebframeworkBenchmars' database

Database hello_world contains table world with 10000 records and two columns id, randomnumber. Here we are fetching 5 records in a loop. Using Tungsten 100 loops took about 22 on my VPS, whereas similar code using CL-POSTGRES runs 100000 loops in 40 second on the same machine.

CL-POSTGRES code uses get-a-random-record defined like this:

(defun get-a-random-record (id)
  (declare (fixnum id))
@svetlyak40wt
svetlyak40wt / packages-finder.lisp
Created April 12, 2023 17:42
This code collects all packages, created by ASDF-SYSTEM and it's dependencies
;; This code collects all packages, created by ASDF-SYSTEM and it's dependencies
(let* ((asdf-system :cl-telegram-bot)
(packages-before (list-all-packages))
(packages-after (progn (ql:quickload asdf-system)
(list-all-packages))))
(sort (set-difference packages-after packages-before
:key #'package-name
:test #'string=)
#'string<
:key #'package-name))
(defun print-dependency-graph (system-name &key (level 0))
(loop repeat level
do (format t " "))
(format t "~A~%" system-name)
(typecase system-name
((or string symbol)
(let ((system (asdf/system:find-system system-name)))
(loop for dep in (asdf/system:system-depends-on system)
do (print-dependency-graph dep :level (1+ level)))))))
@svetlyak40wt
svetlyak40wt / cl-reex-examples.lisp
Created February 5, 2023 07:29
Examples of the CL-REEX Common Lisp library
(in-package :cl-user)
(defparameter *observer*
(rx:make-observer
(rx:on-next (x) (print x))
(rx:on-error (x) (format t "error: ~S~%" x))
(rx:on-completed () (print "completed")) ))
(defparameter *sequence*
* (kandria:launch)
WARNING: No server for :PORT: 4005
2023-01-15 14:01:42 [INFO ] <TRIAL.SETTINGS>: Loading settings from /Users/art/.config/shirakumo/kandria/settings.lisp
2023-01-15 14:01:42 [INFO ] <TRIAL.SETTINGS>: Saving settings to /Users/art/.config/shirakumo/kandria/settings.lisp
2023-01-15 14:01:45 [INFO ] <TRIAL.MAIN>: GENESIS
2023-01-15 14:01:45 [INFO ] <TRAIL.MAIN>: Launching version 1.0.0-458e21a
[CoreAudio] Matching default device sample rate 48000
[Harmony] Will use ORG.SHIRAKUMO.FRAF.MIXED.COREAUDIO:DRAIN for output (2xFLOAT @ 48000kHz)
STYLE-WARNING:
slot names with the same SYMBOL-NAME but different SYMBOL-PACKAGE (possible
(ql:quickload :40ants-doc-full)
(ql:quickload :polymorphic-functions)
(use-package :polymorphic-functions)
(define-polymorphic-function my= (a b)
:documentation "Test polymorphic function.")
(uiop:define-package #:40ants-doc-full/locatives/polymorphic-function
(:use #:cl)
(:import-from #:polymorphic-functions
@svetlyak40wt
svetlyak40wt / ningle-defroute.lisp
Created March 4, 2022 13:04
Example of a simple DEFROUTE macro for Ningle Common Lisp web framework
(uiop:define-package #:ningle-defroute
(:use #:cl))
(in-package #:ningle-defroute)
(defmacro defroute (app path-or-path-with-options (&rest view-arguments) &body view-body)
(let* ((path-with-options (uiop:ensure-list path-or-path-with-options))
(params (gensym "PARAMS"))
(bindings (loop for arg-name in view-arguments
@svetlyak40wt
svetlyak40wt / ningle-uploader.lisp
Created February 11, 2022 16:36
Example of a simple file uploader using Common Lisp and Ningle framework
;; License: MIT
(uiop:define-package #:ningle-upload
(:use #:cl)
(:import-from #:cl-fad)
(:import-from #:ningle)
(:import-from #:spinneret)
(:import-from #:log4cl))
(in-package #:ningle-upload)