Skip to content

Instantly share code, notes, and snippets.

Florian Margaine ralt

Block or report user

Report or block ralt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ralt
ralt / README.md
Last active Aug 28, 2019
horse-html: extension to Parenscript
View README.md

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 Aug 20, 2019
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 ")"))
(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 Aug 29, 2019
my eshell config
View eshell.org

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 Jul 6, 2019
How to make bluetooth flawless in gnome shell
View install-bluetooth.sh
#!/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 Jul 9, 2018
Slow down stdout
View slower.py
#!/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 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
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))))
(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
View gist:ed0a6f1ad52a946e7a1822ef679fa91a
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
View gist:a5363283772869cb307cc0e68b5ef750

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
View gist:c72f7274f2b4ca218a90f956601f62c6
Handling request for http://margaine.com/
debugger invoked on a HTTPICKLE::HTTPICKLE-CONDITION in thread
#<THREAD "main thread" RUNNING {1003266DB3}>:
on incoming HTTP REQUEST
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
You can’t perform that action at this time.