Skip to content

Instantly share code, notes, and snippets.

View sjl's full-sized avatar

Steve Losh sjl

View GitHub Profile
><((°> abcl
Picked up _JAVA_OPTIONS: -Djava.awt.headless=true
Armed Bear Common Lisp 1.3.3
Java 1.8.0_25 Oracle Corporation
Java HotSpot(TM) 64-Bit Server VM
Low-level initialization completed in 0.247 seconds.
Startup completed in 1.202 seconds.
Loading /Users/sjl/.abclrc completed in 8.332 seconds.
Type ":help" for a list of available commands.

The past few months I've been working on implementing Prolog in Common Lisp. The current code is here. It's an implementation of the Warren Abstract Machine, which is what most real-world, modern Prologs use (SWIProlog, gprolog, YAP, Eclipse, etc).

Current State

It's not done yet, but it's coming along nicely. It's missing a few key pieces,

(defun get-body (env)
(let* ((content-length (getf env :content-length))
(raw-body (getf env :raw-body))
(body (make-string content-length)))
(read-sequence body raw-body)
body))
@sjl
sjl / gdl-kif.vim
Created January 22, 2016 10:26 — forked from muupan/gdl-kif.vim
A sintax file for Game Description Language (GDL) in Knowledge Interchange Format (KIF).
" A sintax file for Game Description Language (GDL) in Knowledge
" Interchange Format (KIF).
"
" Put this file in .vim/syntax/ and and add set filetype gdl-kif
" Example:
" au BufRead,BufNewFile *.kif set filetype=gdl-kif
syntax region gdlKifLineComment start=+;+ end=+$+
syntax match gdlKifArrow '<='
syntax keyword gdlKifFactRelation base init true next
body{
margin:40px auto;
max-width:650px;
line-height:1.6;
font-size:18px;
color:#222;
padding:0 10px;
}
h1,h2,h3{line-height:1.2}
//////////////////////////// Auto-observe stars
// Start
starClick = setInterval(function() { $("#gameLog").find("input").click(); }, 2 * 1000);
// Stop
clearInterval(starClick);
////////////////////////// Autoconvert 'nip
@sjl
sjl / ext.vim
Created December 15, 2014 18:58
ways to run external commands in vim
" run command
" no stdin
" output displayed in "Press enter to continue" style
" current buffer untouched
:!uptime
" run command
" pipe range of text to command on stdin
" output replaces the range in the current buffer
:RANGE!grep foo
sjl at grendel in ~/Library/Application Support/Adobe/Lightroom/Develop Presets/VSCO Film 06 Push & Pull - Standard
><((°> ag 'Sharpness = 0' | grep lrtemplate
400H+1 +++.lrtemplate:66: Sharpness = 0,
400H+1 ++.lrtemplate:66: Sharpness = 0,
400H+1 -.lrtemplate:66: Sharpness = 0,
400H+1 +.lrtemplate:66: Sharpness = 0,
400H+1 Over +.lrtemplate:66: Sharpness = 0,
400H+1 Night.lrtemplate:66: Sharpness = 0,
400H+1 Over.lrtemplate:66: Sharpness = 0,
400H+1 Vibrant.lrtemplate:66: Sharpness = 0,

How to become a decent photographer in five years

You're not gonna become a master in your spare time, but you can get decently good at photography in five years of dedicated but non-full-time practice. It's taken me about twice that to get decent, but I fucked around a lot along the way.

You don't need a ton of fancy equipment, but photography does require some gear. I'll limit the gear-buying here to once a year (not counting books).

(require '[lanterna.screen :as s])
(def scr (s/get-screen))
(s/start scr)
(s/put-string scr 10 10 "Hello, world!")
(s/put-string scr 10 11 "Press any key to exit!")
(s/redraw scr)
(s/get-key-blocking scr)