Skip to content

Instantly share code, notes, and snippets.


Florian Margaine ralt

View GitHub Profile
ralt /
Created Aug 29, 2015
LAMP template for lxc
# Fork of lxc-debian
# Highly opinionated. Updates libvirt's default network.
# The --ip argument is the last number of the IP
# The --mac argument is the last number of the MAC
# Detect use under userns (unsupported)
for arg in "$@"; do
[ "$arg" = "--" ] && break
ralt / foo.lisp
Last active Jan 17, 2021
Parenscript async/await support
View foo.lisp
(ps::defprinter ps-js::await (x)
(ps::psw (string-downcase "(await "))
(ps::print-op-argument 'ps-js::await x)
(ps::psw ")"))
await ps-js::await)
(ps::define-statement-operator async-defun (name lambda-list &rest body)
(multiple-value-bind (effective-args body-block docstring)
ralt /
Last active Dec 23, 2020
my eshell config


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 /
Last active Sep 21, 2020
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.

View static-compile-c-file.diff
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 /
Last active Jul 6, 2019
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 /
Last active Jul 9, 2018
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 / gist:f4bd9e9133dee42e36a6
Last active Apr 16, 2018
The Contributors Army
View gist:f4bd9e9133dee42e36a6

tl;dr we're lazy, we're coders.

Let's make use of that.

  • We don't like to start off new projects and write all the booooring boilerplate
  • We like to fiddle with code and fix it
  • We like recognition
  • We're quickly bored

Hence, I present to you my idea:

ralt / 000.mkd
Created Feb 25, 2018 — forked from packz/000.mkd
Static cryptsetup
View 000.mkd

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 / stumpwmrc.lisp
Created Nov 24, 2017
StumpWM integration with password store, aka "pass"
View stumpwmrc.lisp
(defun pass-entries ()
(let* ((home (merge-pathnames #p".password-store/" (user-homedir-pathname)))
(home-ns-len (length (namestring home))))
(lambda (entry)
(let ((entry-ns (namestring entry)))
(subseq entry-ns home-ns-len (- (length entry-ns) 4))))
(directory (make-pathname :directory `(,@(pathname-directory home)
:name :wild