Skip to content

Instantly share code, notes, and snippets.

View ralt's full-sized avatar

Florian Margaine ralt

View GitHub Profile
modified src/libraries.lisp
@@ -372,7 +372,7 @@ This will need to be extended as we test on more OSes."
(load-foreign-library-path name library-path search-path)))
(:or (try-foreign-library-alternatives name (rest thing) search-path))))))
-(defun %do-load-foreign-library (library search-path)
+(defun %do-load-foreign-library (library search-path type)
(flet ((%do-load (lib name spec)
(when (foreign-library-spec lib)
(with-slots (handle pathname) lib
@ralt
ralt / README.md
Last active September 21, 2020 17:41
horse-html: extension to Parenscript

My main gripe with who-ps-html is that it generates a string, which means that you don't have a real DOM object to play with; you must wait to render that object before being able to do things on it.

horse-html fixes that by generating real DOM elements in JavaScript, and returning those.

The absolute best feature of horse-html is that the closures also magically work. If you define an onclick on an element, the JavaScript will use the closures generated wherever your code is defining that onclick attribute.

PS: the code can definitely be improved. I suck. But for the little use cases I have, it works. Feedback definitely welcome. I'm notably not a fan of the nested functions, but couldn't figure out a better way.

@ralt
ralt / foo.lisp
Last active October 30, 2024 15:42
Parenscript async/await support
(ps::defprinter ps-js::await (x)
(ps::psw (string-downcase "(await "))
(ps::print-op-argument 'ps-js::await x)
(ps::psw ")"))
(ps::define-trivial-special-ops
await ps-js::await)
(ps::define-statement-operator async-defun (name lambda-list &rest body)
(multiple-value-bind (effective-args body-block docstring)
@ralt
ralt / eshell.org
Last active January 19, 2022 19:18
my eshell config

Eshell

eshell is the shell I’ve tried using over time, and in the end just never stick with it. Let’s try one more time with a couple of tricks. The first tricks are mostly documentation:

  • M-& in a tramp-aware session means you run commands in a new buffer, without a TTY. Great for things like tailf.
  • for ncurses-like applications, “visual commands” is the missing context. Applications like top are in the default list by default,
@ralt
ralt / install-bluetooth.sh
Last active July 6, 2019 22:27
How to make bluetooth flawless in gnome shell
#!/usr/bin/env bash
# This shell script setups bluetooth to be flawless in gnome shell.
# Devices are now instantly connected when they're near the laptop.
# (It probably works as a service for random WMs too.)
# The issue is essentially that gnome-bluetooth is issuing the wrong
# dbus calls to connect the device immediately; org.bluez gets EAGAIN
# from the kernel when it processes gnome-bluetooth dbus calls (until
# it eventually succeeds, 20-30s later). However, bluetoothctl is
@ralt
ralt / slower.py
Last active July 9, 2018 08:43
Slow down stdout
#!/usr/bin/env python
import gevent.monkey; gevent.monkey.patch_all()
import os.path
import sys
import tempfile
import threading
import time
@ralt
ralt / 000.mkd
Created February 25, 2018 21:45 — forked from packz/000.mkd
Static cryptsetup

I suppose you use Debian-like systems

$ mkdir rootdir && cd rootdir && export ROOTDIR=$PWD
$ apt-get source libdevmapper1.02.1
$ apt-get source cryptsetup
@ralt
ralt / stumpwmrc.lisp
Created November 24, 2017 21:51
StumpWM integration with password store, aka "pass"
(defun pass-entries ()
(let* ((home (merge-pathnames #p".password-store/" (user-homedir-pathname)))
(home-ns-len (length (namestring home))))
(mapcar
(lambda (entry)
(let ((entry-ns (namestring entry)))
(subseq entry-ns home-ns-len (- (length entry-ns) 4))))
(directory (make-pathname :directory `(,@(pathname-directory home)
:wild-inferiors)
:name :wild
modified src/tests/Makefile.in
@@ -1,12 +1,13 @@
# -*- Mode: Makefile; indent-tabs-mode: nil -*-
# vim: set filetype=makefile tabstop=8 shiftwidth=4 expandtab:
-ECL=@prefix@/@bindir@/ecl@EXEEXT@
+ECL=../bin/ecl@EXEEXT@
.PHONY: all

root.tar.gz is an 8MB file.

SBCL:

CL-USER> (time (ironclad:digest-file :sha256 "../root.tar.gz"))
Evaluation took:
  0.072 seconds of real time
  0.071849 seconds of total run time (0.071849 user, 0.000000 system)
 100.00% CPU