Skip to content

Instantly share code, notes, and snippets.

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

Michał "phoe" Herda phoe

🤔
:thonk:
View GitHub Profile
@no-defun-allowed
no-defun-allowed / selling-lisp-by-the-pound.org
Last active April 17, 2024 06:10
Selling Lisp by the pound

Selling Lisp by the Pound

“Paper late!” cried a voice in the crowd,

“Old man dies!” The note he left was signed,

‘Old Kiczales’ - it seems he’s drowned!

@death
death / inheritance-graph.lisp
Created July 3, 2020 19:35
inheritance graph
(defpackage #:snippets/inheritance-graph
(:use #:cl)
(:import-from #:sb-mop
#:class-direct-subclasses))
(in-package #:snippets/inheritance-graph)
(defstruct digraph
(strict-p t)
(name "unnamed")
@vseloved
vseloved / rutils-tutorial.md
Last active December 19, 2021 11:31
RUTILS Tutorial

RUTILS Tutorial

Overview

RUTILS is split into two parts: core (package rutils) and contrib (package rutilsx). These are aggregate packages that just re-export the symbols that are provided by the specific packages like rutils.anaphora or rutils.list. Overall, there are 17 parts of the core, which are described, in more detail, in this tutorial. They include (with some changes and additions) 3 facilities, which are also available from separate libraries: SPLIT-SEQUENCE, ITERATE, and ANAPHORA. Besides, it defines 2 lightweight wrapper data structures: pair and hash-set.

There's also the package rtl that includes the core plus short names for a lot of basic Lisp operations.

Contrib holds "experimental" stuff (in the sense that it's not totally conventional even for me) that, gradually, migrates to core. I won't talk more about it in the tutorial: those who are interested can check on their own or ask questions.

@shakdwipeea
shakdwipeea / godot_ecl.c
Created December 9, 2018 09:05
godot with cl
#include <gdnative_api_struct.gen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ecl/ecl.h>
/*************/
/* Setup ecl */
/*************/
@phoe
phoe / lzma.lisp
Last active July 17, 2017 19:22
LZMA wrapper for Common Lisp
#|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; CFFI LZMA Wrapper
;; © Michał "phoe" Herda 2017
;; public domain
;; Use the attached lzma.so file, which is a x64 Linux shared
;; object. To compile the shared library file yourself:
;; 1. Install the official LZMA SDK from Igor Pavlov.
@cmer
cmer / haproxy.cfg
Last active April 15, 2024 09:54
Simple, no bullshit TCP port forwarding using HAProxy
listen l1
bind 0.0.0.0:443
mode tcp
timeout connect 4000
timeout client 180000
timeout server 180000
server srv1 host.example.com:9443
@Treeki
Treeki / lzma_sample.cpp
Created May 24, 2017 21:52
simple LZMA SDK compression/decompression example
// note: -D_7ZIP_ST is required when compiling on non-Windows platforms
// g++ -o lzma_sample -std=c++14 -D_7ZIP_ST lzma_sample.cpp LzmaDec.c LzmaEnc.c LzFind.c
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <memory>
#include "LzmaEnc.h"
#include "LzmaDec.h"
@serialhex
serialhex / normal-random.lisp
Last active September 14, 2022 15:51
Generate normal (gaussian) random numbers in lisp!
(defun normal-random (mean std-dev)
"Normal random numbers, with the given mean & standard deviation."
(do* ((rand-u (* 2 (- 0.5 (random 1.0))) (* 2 (- 0.5 (random 1.0))))
(rand-v (* 2 (- 0.5 (random 1.0))) (* 2 (- 0.5 (random 1.0))))
(rand-s (+ (* rand-u rand-u) (* rand-v rand-v))
(+ (* rand-u rand-u) (* rand-v rand-v))))
((not (or (= 0 rand-s) (>= rand-s 1)))
(+ mean
(* std-dev
(* rand-u (sqrt (/ (* -2.0 (log rand-s)) rand-s))))))))
@josteink
josteink / on_stateful_code.txt
Last active October 21, 2020 05:37
On why stateful code is bad
On why stateful code is bad
===========================
STUDENT: Sir, can I ask a question?
TEACHER: Yes!
STUDENT: How do you put an elephant inside a fridge?
TEACHER: I don't know.
STUDENT: It's easy, you just open the fridge and put it in. I have another question!
TEACHER: Ok, ask.
STUDENT: How to put a donkey inside the fridge?