Skip to content

Instantly share code, notes, and snippets.

@zilti
zilti / core.clj
Created October 28, 2018 21:19
Nested macro vs. macro plus function with eval
;; This approach works as intended:
(defn- connect-fn [instance iface method args & code]
(eval `(proxy [~iface] []
(~(symbol (.getName method)) ~args
~@code))))
(defmacro connect [instance method args & code]
`(let [functional-method# (first (clojure.lang.Reflector/getMethods (class ~instance) 1 ~(str "set" (camelcase (name method))) false))
functional-para# (symbol (.getName (first (.getParameterTypes ^Method functional-method#))))]
@zilti
zilti / AppRun
Last active March 23, 2019 17:57
AppImage creation script for CKAN
#!/usr/bin/env bash
HERE="$(dirname "$(readlink -f "${0}")")"
echo $HERE
export PATH=${HERE}/usr/sbin:${HERE}/usr/bin:$PATH
export LD_LIBRARY_PATH=$HERE/usr/lib64:$HERE/usr/lib:$HERE/lib64:$LD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=$LD_LIBRARY_PATH:$DYLD_FALLBACK_LIBRARY_PATH
export LD_RUN_PATH=$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$HERE/usr/lib64/pkgconfig:$PKG_CONFIG_PATH
export MONO_GAC_PREFIX=${HERE}
export MONO_PATH=${HERE}/usr/lib/mono/4.5
@zilti
zilti / PrincipiaError
Created February 6, 2019 19:49
Prinicpia Error Log
Log file created at: 2019/02/06 20:45:10
Running on machine: lyriondesktop
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
E0206 20:45:10.861512 21477 ephemeris_body.hpp:845] New Apocalypse: INVALID_ARGUMENT: Error extending trajectory for Adrastea. Error trying to fit a smooth polynomial to the trajectory. The approximation error jumped from +1.00000000000000002e-03 m to +2.20807567213433236e+08 m at time -1.57787520000000000e+09 s. The last position is {+6.63467939054516449e+10 m, +5.43501466695274506e+10 m, +3.07659575804323807e+10 m} and the last velocity is {+1.76343414987203293e+07 m s^-1, +1.43827566544367932e+07 m s^-1, +8.15714472457679734e+06 m s^-1}. An apocalypse occurred and two celestials probably collided because your solar system is unstable.
E0206 20:45:10.861645 21477 ephemeris_body.hpp:845] New Apocalypse: INVALID_ARGUMENT: Error extending trajectory for Amalthea. Error trying to fit a smooth polynomial to the trajectory. The approximation error jumped from +1.0000000000
@zilti
zilti / etc_pam.d_common-session
Created February 7, 2019 12:08
OpenSUSE eCryptFS PAM
#%PAM-1.0
#
# This file is autogenerated by pam-config. All changes
# will be overwritten.
#
# Session-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define tasks to be performed
# at the start and end of sessions of *any* kind (both interactive and
@zilti
zilti / example.clj
Created March 9, 2020 21:35
Self-contained clojure program demonstrating how trying to edit a table cell causes infinite spam of CellEditEvents
#!/bin/sh
#_(
DEPS='
{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
cljfx {:mvn/version "1.6.5"}}}
'
OPTS=''
exec clj $OPTS -Sdeps "$DEPS" "$0" "$@"
)