Skip to content

Instantly share code, notes, and snippets.

View jl2's full-sized avatar

Jeremiah LaRocco jl2

View GitHub Profile
(defun read-element-symbols (fname)
(sort (cdr (mapcar (compose #'string-downcase #'cadr)
(with-open-file (ins fname) (cl-csv:read-csv ins))))
#'<
:key #'length))
(defun find-words ( &optional (element-csv "~/elements.csv") (word-file "/usr/share/dict/american-english"))
(let* ((regex (format nil "~{\(~a\)~^|~}" (read-element-symbols element-csv)))
(scanner (cl-ppcre:create-optimized-test-function (cl-ppcre:create-scanner regex))))
(with-open-file (ins word-file)
@jl2
jl2 / .emacs
Last active March 9, 2017 20:46
;; (setq default-frame-alist
;; '((width . 120) (height . 36)
;; (cursor-color . "red")
;; (cursor-type . box)
;; (foreground-color . "gray90")
;; (background-color . "black")
;; (alpha . 50)))
(add-to-list 'load-path "~/.emacs_stuff/")
(load "~/.emacs_stuff/my_functions")
(ql:quickload :quickproject)
(quickproject:make-project "~/src/lisp/dots-and-boxes/" :depends-on '(:qtools :qtgui :qtcore))
(ql:quickload :dots-and-boxes)
#!/usr/bin/lisp --script
;;-*-lisp-*-
(let* ((git-out-string (make-array '(0) :element-type 'base-char :fill-pointer 0 :adjustable t))
(done-str "Already up-to-date")
(len-done (length done-str))
(emacs-dir (merge-pathnames "oss_src/emacs" (user-homedir-pathname)))
(force-build (string= "--force" (second sb-ext:*posix-argv*))))
(with-output-to-string (s git-out-string)
#!/usr/bin/lisp --script
;; -*-lisp-*-
(defmacro home (path)
`(merge-pathnames ,path (user-homedir-pathname)))
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
export LS_COLORS='di=33'
alias ls='ls --color=auto'
alias ll='ls -alF --color=auto'
alias la='ls -A --color=auto'
alias l='ls -CF --color=auto'
alias lsd='ls -d --color=auto */'
alias grep='grep -in --color=auto'
alias fgrep='fgrep -in --color=auto'
alias egrep='egrep -in --color=auto'
@jl2
jl2 / browser
Last active February 25, 2016 18:34
#!/bin/sh
# urxvt #/home/jeremiah/oss/chrome"
export CHROME_DEVEL_SANDBOX=/home/jeremiah/oss/chrome-linux/chrome_sandbox
cd /home/jeremiah/oss/chrome-linux
./chrome "$@" --enable-plugins --ppapi-flash-path=/opt/google/chrome/PepperFlash/libpepflashplayer.so --ppapi-flash-version=17.0.0.188
# opera-developer "$@"
@jl2
jl2 / updateemacs.lisp
Created January 7, 2016 00:54
Update and build Emacs from Git.
;; Requires Emacs cloned from git://git.savannah.gnu.org/emacs.git
(let* ((git-out-string (make-array '(0) :element-type 'base-char
:fill-pointer 0 :adjustable t))
(done-str "Already up-to-date")
(len-done (length done-str))
(emacs-dir "/home/jeremiah/oss_src/emacs")
(force-build (string= "--force" (second sb-ext:*posix-argv*))))
(with-output-to-string (s git-out-string)
@jl2
jl2 / make-static-gist.lisp
Last active November 30, 2015 02:36
Quick and dirty Common Lisp function to generate static HTML from a gist URL.
(defun make-static-gist (gist-url)
"Retrieve a Gist from GitHub and format it as static CSS and HTML."
(let* ((nl-string (format nil "~c" #\newline))
;; Make sure the url has ".js" on the end
(ending (subseq gist-url (- (length gist-url) 3)))
(js-url (if (string= ending ".js")
gist-url
(concatenate 'string gist-url ".js")))
;; Fetch the embedded gist from GitHub
(gist-data (drakma:http-request js-url)))
* (ql:quickload 'gpxtools)
To load "gpxtools":
Load 1 ASDF system:
gpxtools
; Loading "gpxtools"
.....
(GPXTOOLS)
* (defparameter *gpx*
(gpxtools:read-gpx "/Users/jeremiah/gpx_tracks/precarious_climb.gpx"))
Processing track: ACTIVE LOG