This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env clj-env | |
;; -*- mode: clojure -*- | |
(loop [expr ""] | |
(when-let [l (str expr " " (read-line))] | |
(recur (if (apply = (map (comp count #(filter (partial = %) l)) [\( \)])) | |
(do (println (eval (read-string l))) "") l)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(in-ns bin-ed.core) ; https://github.com/eschulte/bin-ed | |
;; example: parse the header of an elf file | |
(let [a-out (file-to-bytes "data/a.out") | |
head-ident-tmpl [:mag0 :byte | |
:mag1 :char | |
:mag2 :char | |
:mag3 :char | |
:class :byte | |
:data :byte |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns propagator.spreadsheet ; see http://gitweb.adaptive.cs.unm.edu/propagator.git | |
(use propagator)) | |
(def xrange 10) (def yrange 10) | |
(def spreadsheet | |
(map (fn [_] (map (fn [_] | |
(let [c (gensym)] (eval `(defcell ~c nil)) c)) | |
(range xrange))) | |
(range yrange))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmacro lambdab ((&rest instrs) &rest body) | |
"Use `bind' to allow restructuring of argument to lambda expressions." | |
(declare (indent 1)) | |
(let* ((evald-instrs instrs) | |
(syms (mapcar (lambda (_) (gensym)) evald-instrs))) | |
`(lambda ,syms (bind ,(mapcar #'list evald-instrs syms) ,@body)))) | |
;; example usage | |
(let ((fn (lambdab ((a b) c) (cons a c)))) | |
(funcall fn '(1 2) 3)) ;; => (1 . 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Configuration for running xmonad as the window manager over XFCE | |
-- see http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Doc-Extending.html | |
import XMonad | |
import XMonad.Layout.NoBorders -- to remove window borders | |
import XMonad.Hooks.ManageDocks -- manage docks and panels | |
import qualified XMonad.StackSet as W -- to shift and float windows | |
import qualified Data.Map as M -- used to add key bindings | |
myManageHook = composeAll | |
-- per-window options, use `xprop' to learn window names and classes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require :cl-irc) (require :cl-ppcre) | |
(defpackage :adapt-bot (:use :cl :cl-irc :cl-ppcre)) | |
(in-package :adapt-bot) | |
(defvar *connection* | |
(connect :nickname "adaptive-lab-bot" :server "irc.freenode.net")) | |
(defvar *group* "#adaptiveunm") | |
(defun say (fmt &rest args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun all-to-string (tbl) | |
(if (listp tbl) | |
(mapcar #'all-to-string tbl) | |
(if (stringp tbl) | |
tbl | |
(format "%s" tbl)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#+source: hetero-table | |
#+begin_src emacs-lisp | |
'((1 2 3 4) | |
("a" "b" "c" "d")) | |
#+end_src | |
#+source: all-to-string | |
#+begin_src emacs-lisp :var tbl='() | |
(defun all-to-string (tbl) | |
(if (listp tbl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Swap Caps lock and Control | |
# | |
xmodmap -e "remove Lock = Caps_Lock" | |
xmodmap -e "remove Control = Control_L" | |
xmodmap -e "keysym Control_L = Caps_Lock" | |
xmodmap -e "keysym Caps_Lock = Control_L" | |
xmodmap -e "add Lock = Caps_Lock" | |
xmodmap -e "add Control = Control_L" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CL-USER> (ql:system-apropos "tree") | |
#<SYSTEM bk-tree / bk-tree-20110219-git / quicklisp 2011-04-18> | |
#<SYSTEM cl-btree-0.5 / cl-btree-0.5 / quicklisp 2011-04-18> | |
#<SYSTEM mcclim-tree-with-cross-edges / mcclim-20101006-cvs / quicklisp 2011-04-18> | |
#<SYSTEM spatial-trees / spatial-trees-20101006-darcs / quicklisp 2011-04-18> | |
#<SYSTEM trees / trees_0.11 / quicklisp 2011-04-18> | |
#<SYSTEM vcs-tree / vcs-tree-20101006-git / quicklisp 2011-04-18> |