Skip to content

Instantly share code, notes, and snippets.

View phoe's full-sized avatar
🤔
:thonk:

Michał "phoe" Herda phoe

🤔
:thonk:
View GitHub Profile
@phoe
phoe / char-check.lisp
Created August 6, 2017 21:40
CL: Check which CODE-CHARs do not yield characters
(defun char-check ()
"Print all codes for which (code-char a) returns nil and return their number.
If this returns nonzero, there is a hole in the code-chars,
so be careful.
If this returns 0, the implementation is effectively
NIL-proof in this case.
NIL-bearing so far:
CCL 1.11-r16635 on Win32, beginning at 55295. 2048 codes (D800-DFFF) under 1114112 have a (code-char code) -> nil.
NIL-proof so far:
@phoe
phoe / defslimefun
Last active August 9, 2017 14:49
Swank/Slime protocol - keywords
contrib/swank-arglists.lisp:1136:(defslimefun autodoc (raw-form &key print-right-margin)
contrib/swank-arglists.lisp:1185:(defslimefun complete-form (raw-form)
contrib/swank-arglists.lisp:1201:(defslimefun completions-for-keyword (keyword-string raw-form)
contrib/swank-asdf.lisp:335:(defslimefun who-depends-on (system)
contrib/swank-asdf.lisp:362:(defslimefun operate-on-system-for-emacs (system-name operation &rest keywords)
contrib/swank-asdf.lisp:385:(defslimefun list-all-systems-in-central-registry ()
contrib/swank-asdf.lisp:408:(defslimefun list-all-systems-known-to-asdf ()
contrib/swank-asdf.lisp:413:(defslimefun list-asdf-systems ()
contrib/swank-asdf.lisp:438:(defslimefun asdf-system-files (name)
contrib/swank-asdf.lisp:451:(defslimefun asdf-system-loaded-p (name)
@phoe
phoe / fox5.lisp
Created August 9, 2017 21:10
FOX5 decoder, first sketch
;;;; CL-FOX5 2017 © Michał "phoe" Herda
;;;; MIT license
;; (ql:quickload :fast-io)
;; (ql:quickload :cl-lzma)
;; (ql:quickload :alexandria)
;;; UTILS
(defun make-byte-array (n &rest options)
;;; (ql:quickload :qtools)
(defmacro with-qimage-from-vector ((image-var vector width height) &body body)
"Establishes a lexical environment, in which IMAGE-VAR is bound to a QImage
created from the ARGB contents of VECTOR, with width WIDTH and height HEIGHT."
(with-gensyms (length v)
`(let* ((,length (array-dimension ,vector 0))
(,v (make-static-vector ,length :initial-contents vector)))
(unwind-protect
(with-finalizing
@phoe
phoe / hmmm.lisp
Last active October 6, 2017 15:01
Common Lisp that makes you go hmmm
"This one should be fairly obvious."
(defun the-answer-to-life-the-universe-and-everything ()
(+(*(+(*)(*))(+(*)(*)(*)))(*(*(+(*)(*))(+(*)(*)(*)))(*(+(*)(*))(+(*)(*)(*))))))
"The advanced version of the above."
(defun rick (
) (
+ (+
) ( *) (
*) (+) ( *)
@phoe
phoe / swank.lfe
Last active October 17, 2017 03:05
SWANK-LFE fifth(?) draft
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; SWANK-LFE
;;;; © Michał "phoe" Herda 2017
;;;; swank.lfe
(defmodule swank
(export
;; ## Utils
(curry 2) (curry 3) (curry 4)
;; (start_server 1) (stop_server 0) (start_listener 2)
@phoe
phoe / kitterspeak.md
Last active February 5, 2018 16:14 — forked from Treeki/kitterspeak.md
Kitterspeak Reference
@phoe
phoe / thread-pid.lisp
Created February 25, 2018 10:22
Thread PIDs on SBCL on Linux
;; NOTE: absolutely non-portable
* (sb-alien:alien-funcall
(sb-alien:extern-alien "syscall" (function sb-alien:unsigned int)) 186)
3288 ;; this is the correct PID of the main SBCL thread
* (bt:make-thread (lambda ()
(sb-alien:alien-funcall
(sb-alien:extern-alien "syscall" (function sb-alien:unsigned int)) 186)))
#<SB-THREAD:THREAD "Anonymous thread" FINISHED values: 3412 {100364B363}>
@phoe
phoe / qtools-ui-drag-and-drop.md
Created February 25, 2018 15:22
Qtools UI drag and drop

Qtools UI - Drag and Drop

This module contains classes implementing drag and drop functionality inside Qtools UI.

Concept

Drag and drop functionality in Qt revolves around MIME types. A single drag can contain data in multiple formats, each of them described by a single MIME type in form of a string.

For simplicity, the mechanism used in this implementation uses only a single MIME type, which, by default, is "application/qtools-mime-data-with-object", being the value of *MIME-DATA-WITH-OBJECT-TYPE*.

@phoe
phoe / list-otwarty.md
Last active June 26, 2018 16:21
List otwarty do Dziekana WMiI UJ w sprawie artykułów 11 i 13 dyrektywy UE o prawie autorskim

List otwarty

prof. dr hab. Włodzimierz Zwonek
Dziekan Wydziału Matematyki i Informatyki
Uniwersytetu Jagiellońskiego
Łojasiewicza 6
30-348 Kraków

Szanowny Panie Dziekanie,