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 / get-lisp-dependencies.lisp
Last active April 30, 2024 01:08
A helper to gather all lisp system's dependencies
(ql:quickload :fset)
(defun get-dependencies (system)
"Returns a set with all dependencies of a given system.
System should be loaded first."
(labels ((normalize (name)
(etypecase name
(string (string-downcase name))
(symbol (normalize (symbol-name name)))
(list
@svetlyak40wt
svetlyak40wt / triggers.org
Created January 20, 2020 11:25
Спусковые крючки по Дорофееву в формате для Org Mode

Спусковые крючки для очистки мозга

Как пользоваться картой

  1. Карта помогает выгрузить из головы все задачи
  2. Пройдитесь взглядом по всем разделам карты
  3. Если в голове “сидит” задача, то она обязательно всплывёт при взгляде на соответствующий узел
  4. Выписывайте задачи, пока их количество не достигнет 50
  5. Почувствуйте, как гора упала с ваших плеч :)

При составлении карты использовались материалы Максима Дорофеева, mnogosdelal.ru

Учёба

@svetlyak40wt
svetlyak40wt / README.md
Created December 13, 2023 19:13
A fix for quicklisp-client making it work well with package-inferred-asdf systems

This patch fixes two problems:

  • Is that quicklisp is unable to load primary system's dependencies, which are subsystems of other primary system not mentioned in the quicklisp distribution's metadata. Issue quicklisp/quicklisp-client#139
  • When asdf system is known to ASDF, quicklisp client ignores it's dependencies and again, if the system depends on a subsystem of other primary system, ASDF can't load it and quicklisp client too.

How to reproduce the problem

For example, I have reblocks-ui-docs ASDF system. One of it's subsystems depends on reblocks/doc/example subsystem of other package-inferred system available from Quicklisp.

Checkout this repository somewhere:

curl -v http://dist.ultralisp.org
* Trying 172.67.169.20...
* TCP_NODELAY set
* Connected to dist.ultralisp.org (172.67.169.20) port 80 (#0)
> GET / HTTP/1.1
> Host: dist.ultralisp.org
> User-Agent: curl/7.64.1
> Accept: */*
>
< HTTP/1.1 200 OK
@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))
@svetlyak40wt
svetlyak40wt / use-nullmailer.sh
Created February 7, 2016 14:38
Using nullmailer from docker image
# this example shows how to run docker container and use nullmailer, running on a host machine
# first, run a container like that
sudo docker run \
--rm \
-ti \
-v `which sendmail`:`which sendmail` \
-v `which nullmailer-inject`:`which nullmailer-inject` \
-v `which nullmailer-queue`:`which nullmailer-queue` \
(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)))))))