Skip to content

Instantly share code, notes, and snippets.

@priyadarshan
priyadarshan / README.md
Created August 28, 2019 15:37 — forked from ralt/README.md
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.

@priyadarshan
priyadarshan / ccl.md
Last active August 26, 2019 07:52
class-v-struct.lisp CCL bench (Thinkpad x1 Extreme)
? (load "/home/lisp/class-v-struct.lisp")
#P"C:/home/lisp/class-v-struct.lisp"
? (run-test-suite)

(LOOP FOR I FROM 1 TO RUN-TIMES DO (SET-RANDOM-CLASS MY-CLASS-INSTANCE))
took 72,604,000 microseconds (72.604000 seconds) to run.
During that period, and with 12 available CPU cores,
     72,593,750 microseconds (72.593750 seconds) were spent in user mode
              0 microseconds ( 0.000000 seconds) were spent in system mode
@priyadarshan
priyadarshan / lambda.txt
Created July 11, 2019 06:14
lambda.txt -- the ultimate fortune file
This is the file LAMBDA.TXT, version 11.
Last Edit: 2005-Sep-13
To install on systems using BSD fortune(6), rename this file "lambda" and
store it in the appropriate fortunes directory, usually /usr/games/fortune
or /usr/share/fortune or something like that. Then in that directory run
strfile(8) on the "lambda" file which should produce a "lambda.dat". To
test, go to some other directory with no file called "lambda" in it, and
say "fortune lambda". If you get a lispy fortune you win. If not you lose.
To install on other systems simply find a fortune program, install it, and
@priyadarshan
priyadarshan / slow.lisp
Created May 20, 2019 14:48 — forked from j3pic/slow.lisp
Program to test the performance of Lisp file I/O.
;; It is often said that Lisp macros need not be used for optimization purposes. This
;; is an exception. SBCL issued the following warning when compiling the MAKE-ARRAY call
;; below:
;; ; note: unable to optimize because: ELEMENT-TYPE is not constant.
;; I don't want to lose the ability to decide which ELEMENT-TYPE to use by using
;; an :ELEMENT-TYPE argument, so I have to arrange for this argument to be processed
;; at compile time.
@priyadarshan
priyadarshan / plex-on-omnios-r151028-lx-zone.md
Last active May 17, 2022 17:48
Install Plex on OmniOS r151028 via lx zone
@priyadarshan
priyadarshan / csplit.txt
Created September 28, 2018 08:56 — forked from budparr/csplit.txt
Terminal command to split a list of markdown items into separate documents. Given a "slug" value, the file will be named that. You could also change slug to title and create slugs/filenames from the title. You may also want to run your output through a markdown converter, like https://github.com/domchristie/to-markdown
csplit -k -n 3 export.txt '/^@@@/' {'999'}; for i in xx*; do sed -i '' 's/@@@/---/g' $i; done; for i in xx*; do mv $i `egrep -m1 -e 'slug:.*' $i | sed -e s/[^\]\[A-Za-z0-9~.,_{}\(\)\'\-\+]/-/g -e s/slug--//`.md; done
@priyadarshan
priyadarshan / illumos-wipe-disk.sh
Last active May 31, 2020 09:32
illumos/OmniOS - Wipe disks in order to re-use them from previous zpool
#!/usr/bin/ksh93
# This script only wipe same-sized disks for now
SIZE="10000831348736"
LAST_PART=`echo "($SIZE / 1024 / 1024) - 10" | /usr/bin/bc`
# List of disks to wipe
DRIVES="c0t5000CCA26BD0CAFAd0p0 c0t5000CCA26BD116ACd0p0 c0t5000CCA26BD59F6Dd0p0 c0t5000CCA26BD5AAC5d0p0
c0t5000CCA26BD6960Ed0p0 c0t5000CCA26BD6B9CCd0p0 c0t5000CCA26BD6C6D4d0p0 c0t5000CCA26BD6E59Cd0p0"
@priyadarshan
priyadarshan / lobsters-mastodon.lisp
Created August 22, 2018 14:37 — forked from gkbrk/lobsters-mastodon.lisp
Common lisp Mastodon bot
(ql:quickload :drakma)
(ql:quickload :cl-json)
(ql:quickload :plump)
(ql:quickload :babel)
(ql:quickload :tooter)
(ql:quickload :split-sequence)
(defvar *feed-path* "https://lobste.rs/rss")
(setf drakma:*drakma-default-external-format* :UTF-8)
@priyadarshan
priyadarshan / swap-cmd-ctrl.json
Created June 26, 2018 11:47
Karabiner: Swap command and control: LispWorks and terminals
{
"title": "Swap command and control: LispWorks and terminals",
"rules": [
{
"description": "Swap command and control",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "left_control",