Skip to content

Instantly share code, notes, and snippets.

View TeMPOraL's full-sized avatar

Jacek Złydach TeMPOraL

View GitHub Profile
;;; repl.sh
#!/bin/bash
if [[ "$#" -ne 1 ]]; then
echo "Usage: repl.sh 'script to be run'"
exit 1
fi
screen -AdmS 'main' "$1"
(defun m44*m44 (m1 m2)
;; Unrolled, because why the hell not?
;; TODO maybe unroll dot-product and matrix-column/matrix-row as well?
;; for now let's inline them and hope the compiler is not dumb
(make-m44 (⋅ (m44-column m1 0) (m44-row m2 0)) (⋅ (m44-column m1 1) (m44-row m2 1)) (⋅ (m44-column m1 2) (m44-row m2 2)) (⋅ (m44-column m1 3) (m44-row m2 3))
(⋅ (m44-column m1 0) (m44-row m2 0)) (⋅ (m44-column m1 1) (m44-row m2 1)) (⋅ (m44-column m1 2) (m44-row m2 2)) (⋅ (m44-column m1 3) (m44-row m2 3))
(⋅ (m44-column m1 0) (m44-row m2 0)) (⋅ (m44-column m1 1) (m44-row m2 1)) (⋅ (m44-column m1 2) (m44-row m2 2)) (⋅ (m44-column m1 3) (m44-row m2 3))
(⋅ (m44-column m1 0) (m44-row m2 0)) (⋅ (m44-column m1 1) (m44-row m2 1)) (⋅ (m44-column m1 2) (m44-row m2 2)) (⋅ (m44-column m1 3) (m44-row m2 3))))
(defun ⋅ (a b)
"Compute dot product of two vectors."
(assert (= (length a)
(length b))
(a b)
"Cannot compute a dot product of ~S and ~S - lengths of vectors differ." a b)
(reduce #'+ (map 'vector #'* a b)))
(defun × (a b)
"Compute cross product of two 3D vectors."
@TeMPOraL
TeMPOraL / he.css
Created February 3, 2012 20:13
Custom stylesheet for Hackful Europe
/* general */
body
{
margin-left: 100px;
margin-right: 100px;
}
/* comments */
.post
{
(defbehavior root-0
(if (alive)
(if (enemy-in-range)
(attack (find-weakest-enemy-in-range))
(move-to-enemy find-nearest-enemy))))
@TeMPOraL
TeMPOraL / nyan.js
Created November 19, 2011 22:56
Nyan Cat emoticon bindings for Conkeror.
/*
Google now uses "~=[,,_,,]:3" as an emoticon for Nyan Cat animation
on Google Plus. It's handy to have this character sequence bound to
a key. Thanks to Benjamin Slade for the idea.
Nyan Cat is bound by default to "N". As it is to be used when
editing a text field, you'll need to use "C-z" first, so the
sequence is: "C-z N".
Quick hack based on Conkeror source code; namely,
@TeMPOraL
TeMPOraL / keybase.md
Created May 11, 2017 22:49
Android created Gist

Keybase proof

I hereby claim:

  • I am temporal on github.
  • I am temporal_pl (https://keybase.io/temporal_pl) on keybase.
  • I have a public key ASCI--smw7XaN_sGcdGKg27RlH9QLy7Pv8r975Qg4P0YMAo

To claim this, I am signing this object:

@TeMPOraL
TeMPOraL / plump-use.lisp
Created October 3, 2017 18:46
Some examples of using Plump.
(defun parse-tree/fix-anchors (tree base-url)
"Fix anchor URLs in the `TREE' to work correctly with the <base> tag."
(plump:traverse tree
(lambda (node)
(when (starts-with-subseq "#" (plump:attribute node "href"))
(setf (plump:attribute node "href") (concatenate 'string base-url (plump:attribute node "href")))))
:test (lambda (node)
(and (plump:element-p node)
(string-equal (plump:tag-name node) "a")))))
@TeMPOraL
TeMPOraL / emoji.ahk
Created October 4, 2017 13:37
Emoji Picker for Windows (via AutoHotkey)
#F2::
WinGetClass, class, A
Gui, Emojiwin: New, +ToolWindow , Emoji Picker (%class%)
Gui, Font, s12, Segoe UI
Gui, Add, Text,, Pick an emoji:
Gui, Add, Button, gEFacepalm, &1. 🤦 Facepalm
Gui, Add, Button, gEPizza, &2. 🍕 Pizza
Gui, Add, Button, gEParty, &3. 🎉 Party
Gui, Show
Return
@TeMPOraL
TeMPOraL / low-level.lisp
Created November 12, 2017 15:54
cl-sdl-ttf2 hacking; I'm not going to install _yet another_ gcc instance on my Windows machine just because people _have_ to grovel stuff -.-
(in-package :sdl2-ttf)
;;This file contains function definitions that could not be correctly wrapped by cl-autowrap (mainly due to no support for pass by value as of writing 6-22-2015)
(cffi:defcstruct (sdl-color)
(r :uint8)
(g :uint8)
(b :uint8)
(a :uint8))